Skip to content

Commit 77af6e9

Browse files
authored
chore: add github workflow to release docker images (#248)
1 parent 9be32be commit 77af6e9

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Tag server Docker image for release
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository_owner }}/blink-server
10+
11+
jobs:
12+
tag-image:
13+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- name: Log in to the Container registry
19+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
20+
with:
21+
registry: ${{ env.REGISTRY }}
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
27+
28+
- name: Tag image as latest and with git tag
29+
run: |
30+
SHORT_SHA=$(echo "${{ github.event.release.target_commitish }}" | cut -c1-7)
31+
SOURCE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${SHORT_SHA}"
32+
GIT_TAG="${{ github.event.release.tag_name }}"
33+
34+
echo "Tagging ${SOURCE} as latest and ${GIT_TAG}"
35+
36+
docker buildx imagetools create \
37+
--tag "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" \
38+
--tag "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GIT_TAG}" \
39+
"${SOURCE}"

0 commit comments

Comments
 (0)