Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzhichang committed Dec 27, 2023
1 parent e68b786 commit 966df69
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
tags:
- "v*.*.*" # normal release
- "nightly" # mutable tag
- "nightly" # the only one mutable tag

jobs:
release:
Expand All @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 966df69

Please sign in to comment.