Skip to content

blink-server v0.1.4

blink-server v0.1.4 #6

name: Tag server Docker image for release
on:
release:
types: [released]
workflow_dispatch:
inputs:
tag:
description: "Git tag to tag the Docker image with (e.g. 0.1.0)"
required: true
type: string
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/blink-server
jobs:
tag-image:
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
permissions:
contents: read
packages: write
steps:
- name: Log in to the Container registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Resolve commit SHA from git tag
id: resolve
env:
GH_TOKEN: ${{ github.token }}
run: |
GIT_TAG="${{ github.event.release.tag_name || inputs.tag }}"
SHA=$(gh api repos/${{ github.repository }}/git/ref/tags/${GIT_TAG} --jq '.object.sha')
echo "sha=${SHA}" >> "$GITHUB_OUTPUT"
echo "short_sha=${SHA:0:7}" >> "$GITHUB_OUTPUT"
- name: Tag image as latest and with git tag
run: |
SOURCE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.resolve.outputs.short_sha }}"
GIT_TAG="${{ github.event.release.tag_name || inputs.tag }}"
echo "Tagging ${SOURCE} as latest and ${GIT_TAG}"
docker buildx imagetools create \
--tag "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" \
--tag "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GIT_TAG}" \
"${SOURCE}"