This commit is contained in:
Shahrad Elahi 2023-10-02 15:00:14 +03:30
parent ee26a1984c
commit 3c953582ad

View File

@ -9,8 +9,6 @@ on:
env:
IMAGE_NAME: shahradelahi/wireadmin
# By default, image tag is the commit SHA
IMAGE_TAG: ${{ github.sha }}
jobs:
build:
@ -29,12 +27,16 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.PRIVATE_TOKEN }}
# if it was a release tag, use the tag as the image tag
# If it was a release tag, use the tag as the image tag,
# and otherwise image tag is the commit SHA
- name: Set image tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "RELEASE_TAG=,ghcr.io/${IMAGE_NAME}:latest" >> $GITHUB_ENV
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
if [[ $GITHUB_REF == refs/tags/v* ]]; then
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
else
echo "IMAGE_TAG=${GITHUB_SHA}" >> $GITHUB_ENV
fi
echo "Labeling image with ${IMAGE_TAG}"
- name: Push to GitHub Container Registry