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: Checkout repo
26        uses: actions/checkout@v3
27        with:
28          clean: false
29          submodules: 'recursive'
30
31      - name: Determine version
32        run: |
33          set -eu
34          version=$(script/get-crate-version collab)
35          if [[ $GITHUB_REF_NAME != "collab-v${version}" ]]; then
36            echo "release tag ${GITHUB_REF_NAME} does not match version ${version}"
37            exit 1
38          fi
39          echo "Publishing collab version: ${version}"
40          echo "COLLAB_VERSION=${version}" >> $GITHUB_ENV
41
42      - name: Build docker image
43        run: docker build . --tag registry.digitalocean.com/zed/collab:v${COLLAB_VERSION}
44    
45      - name: Publish docker image
46        run: docker push registry.digitalocean.com/zed/collab:v${COLLAB_VERSION}