publish_collab_image.yml

 1name: Publish Collab Server Image
 2
 3on:
 4  push:
 5    tags:
 6      - collab-v*
 7
 8env:
 9  DOCKER_BUILDKIT: 1
10  DIGITALOCEAN_ACCESS_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
11
12jobs:
13  publish:
14    name: Publish collab server image
15    runs-on:
16      - self-hosted
17      - deploy
18    steps:
19      - name: Add Rust to the PATH
20        run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
21
22      - name: Sign into DigitalOcean docker registry
23        run: doctl registry login
24
25      - name: Prune Docker system
26        run: docker system prune
27
28      - name: Checkout repo
29        uses: actions/checkout@v4
30        with:
31          clean: false
32          submodules: 'recursive'
33
34      - name: Determine version
35        run: |
36          set -eu
37          version=$(script/get-crate-version collab)
38          if [[ $GITHUB_REF_NAME != "collab-v${version}" ]]; then
39            echo "release tag ${GITHUB_REF_NAME} does not match version ${version}"
40            exit 1
41          fi
42          echo "Publishing collab version: ${version}"
43          echo "COLLAB_VERSION=${version}" >> $GITHUB_ENV
44
45      - name: Build docker image
46        run: docker build . --tag registry.digitalocean.com/zed/collab:v${COLLAB_VERSION}
47
48      - name: Publish docker image
49        run: docker push registry.digitalocean.com/zed/collab:v${COLLAB_VERSION}