1 files changed,
10 insertions(+),
4 deletions(-)
M
.github/workflows/release.yml
@@ -4,9 +4,12 @@ workflow_dispatch:
push: branches: - main + tags: + - 'v*' env: IMAGE_NAME: ghcr.io/${{ github.repository }} + TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || github.sha }} jobs: release:@@ -16,6 +19,7 @@ contents: read
packages: write steps: - uses: actions/checkout@v4 + - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with:@@ -27,10 +31,12 @@ - name: Fetch extensions
run: ./fetch.sh - name: Build the container - run: ./build.sh $IMAGE_NAME ${{ github.sha }} + run: ./build.sh "$IMAGE_NAME" "$TAG" - name: Publish the container run: | - docker tag "$IMAGE_NAME:${{ github.sha }}" "$IMAGE_NAME:latest" - docker push "$IMAGE_NAME:${{ github.sha }}" - docker push "$IMAGE_NAME:latest" + docker push "$IMAGE_NAME:$TAG" + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + docker tag "$IMAGE_NAME:$TAG" "$IMAGE_NAME:latest" + docker push "$IMAGE_NAME:latest" + fi