diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 894351b..6a50033 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: push: tags: - "v*.*.*" # normal release - - "nightly" # mutable tag + - "nightly" # the only one mutable tag jobs: release: @@ -20,12 +20,18 @@ jobs: - name: Prepare release body run: | - if [[ ${{ github.ref }} =~ ^refs/tags/v(.*) ]]; then - RELEASE_TAG=v${BASH_REMATCH[1]} - PRERELEASE=false + if [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == refs/tags/* ]]; then + RELEASE_TAG=${GITHUB_REF#refs/tags/} + if [[ $RELEASE_TAG == 'nightly' ]]; then + PRERELEASE=true + else + PRERELEASE=false + fi + echo "Workflow triggered by tag: $RELEASE_TAG" else RELEASE_TAG=nightly PRERELEASE=true + echo "Workflow triggered by schedule" fi echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV @@ -38,7 +44,7 @@ jobs: - name: Move the existing mutable tag # https://github.com/softprops/action-gh-release/issues/171 run: | - if [[ $RELEASE_TAG != v* ]]; then + if [[ $GITHUB_EVENT_NAME == 'schedule' ]]; then # Determine if a given tag exists and matches a specific Git commit. if [ "$(git rev-parse -q --verify "refs/tags/$RELEASE_TAG")" = "$GITHUB_SHA" ]; then echo "mutalbe tag $RELEASE_TAG exists and matchs $GITHUB_SHA"