fix(ci): publish docker image from releases

This commit is contained in:
Tam Nhu Tran committed 2026-03-23 09:52:59 -04:00
1 parent 8e90404774
commit 5c1553e6f5
1 file changed
+12 -7
+12 -7
View File
@@ -1,9 +1,9 @@
name: Publish Docker Image name: Publish Docker Image
on: on:
push: release:
tags: types:
- 'v*.*.*' - published
concurrency: concurrency:
group: docker-release-${{ github.ref }} group: docker-release-${{ github.ref }}
@@ -11,27 +11,32 @@ concurrency:
jobs: jobs:
publish: publish:
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-') if: ${{ !github.event.release.prerelease && startsWith(github.event.release.tag_name, 'v') && !contains(github.event.release.tag_name, '-') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
packages: write packages: write
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
steps: steps:
- name: Checkout release tag - name: Checkout release tag
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Validate stable semver tag - name: Validate stable semver tag
id: tag id: tag
run: | run: |
if [[ "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then if [[ "${RELEASE_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "publish=true" >> "$GITHUB_OUTPUT" echo "publish=true" >> "$GITHUB_OUTPUT"
exit 0 exit 0
fi fi
echo "publish=false" >> "$GITHUB_OUTPUT" echo "publish=false" >> "$GITHUB_OUTPUT"
echo "Skipping non-stable semver tag ${GITHUB_REF_NAME}" echo "Skipping non-stable semver tag ${RELEASE_TAG}"
- name: Set up QEMU - name: Set up QEMU
if: steps.tag.outputs.publish == 'true' if: steps.tag.outputs.publish == 'true'
@@ -45,7 +50,7 @@ jobs:
if: steps.tag.outputs.publish == 'true' if: steps.tag.outputs.publish == 'true'
id: meta id: meta
run: | run: |
VERSION="${GITHUB_REF_NAME#v}" VERSION="${RELEASE_TAG#v}"
MINOR="${VERSION%.*}" MINOR="${VERSION%.*}"
MAJOR="${VERSION%%.*}" MAJOR="${VERSION%%.*}"
OWNER_LOWER=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]') OWNER_LOWER=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')