mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-09 10:56:20 +00:00
7b9d51929d
After this change we'll be able to push a tag to github to deploy to collab. The advantages of this are that there's no longer a separate step to first build the image, and then deploy it. In the future I'd like to make this happen more automatically (maybe as part of bump nightly). Release Notes: - N/A
107 lines
2.7 KiB
YAML
107 lines
2.7 KiB
YAML
name: Publish Collab Server Image
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- collab-production
|
|
- collab-staging
|
|
|
|
env:
|
|
DOCKER_BUILDKIT: 1
|
|
DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
|
|
|
jobs:
|
|
style:
|
|
name: Check formatting and Clippy lints
|
|
runs-on:
|
|
- self-hosted
|
|
- test
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
clean: false
|
|
submodules: "recursive"
|
|
fetch-depth: 0
|
|
|
|
- name: Run style checks
|
|
uses: ./.github/actions/check_style
|
|
|
|
tests:
|
|
name: Run tests
|
|
runs-on:
|
|
- self-hosted
|
|
- test
|
|
needs: style
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
clean: false
|
|
submodules: "recursive"
|
|
fetch-depth: 0
|
|
|
|
- name: Run tests
|
|
uses: ./.github/actions/run_tests
|
|
|
|
publish:
|
|
name: Publish collab server image
|
|
needs:
|
|
- style
|
|
- tests
|
|
runs-on:
|
|
- self-hosted
|
|
- deploy
|
|
steps:
|
|
- name: Add Rust to the PATH
|
|
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
|
|
- name: Sign into DigitalOcean docker registry
|
|
run: doctl registry login
|
|
|
|
- name: Prune Docker system
|
|
run: docker system prune --filter 'until=720h' -f
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
clean: false
|
|
submodules: "recursive"
|
|
|
|
- name: Build docker image
|
|
run: docker build . --build-arg GITHUB_SHA=$GITHUB_SHA --tag registry.digitalocean.com/zed/collab:$GITHUB_SHA
|
|
|
|
- name: Publish docker image
|
|
run: docker push registry.digitalocean.com/zed/collab:${GITHUB_SHA}
|
|
|
|
deploy:
|
|
name: Deploy new server image
|
|
needs:
|
|
- publish
|
|
runs-on:
|
|
- self-hosted
|
|
- deploy
|
|
|
|
steps:
|
|
- name: Sign into Kubernetes
|
|
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.CLUSTER_NAME }}
|
|
|
|
- name: Determine namespace
|
|
run: |
|
|
set -eu
|
|
if [[ $GITHUB_REF_NAME = "collab-production" ]]; then
|
|
echo "Deploying collab:$GITHUB_SHA to production"
|
|
echo "KUBE_NAMESPACE=production" >> $GITHUB_ENV
|
|
elif [[ $GITHUB_REF_NAME = "collab-staging" ]]; then
|
|
echo "Deploying collab:$GITHUB_SHA to staging"
|
|
echo "KUBE_NAMESPACE=staging" >> $GITHUB_ENV
|
|
else
|
|
echo "cowardly refusing to deploy from an unknown branch"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Start rollout
|
|
run: kubectl -n "$KUBE_NAMESPACE" set image deployment/collab collab=registry.digitalocean.com/zed/collab:${GITHUB_SHA}
|
|
|
|
- name: Wait for rollout to finish
|
|
run: kubectl -n "$KUBE_NAMESPACE" rollout status deployment/collab
|