Skip to content

Commit

Permalink
use create tags
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzhichang committed Dec 27, 2023
1 parent 966df69 commit f54ebaa
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: release
on:
schedule:
- cron: '*/10 * * * *' # schedule nightly build daily at midnight UTC
push:
# The "create tags" trigger is specifically focused on the creation of new tags, while the "push tags" trigger is activated when tags are pushed, including both new tag creations and updates to existing tags.
create:
tags:
- "v*.*.*" # normal release
- "nightly" # the only one mutable tag
Expand Down Expand Up @@ -48,20 +49,15 @@ jobs:
# 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"
echo "MOVED_MUTABLE_TAG=false" >> $GITHUB_ENV
else
git tag -f $RELEASE_TAG $GITHUB_SHA
git push -f origin $RELEASE_TAG:refs/tags/$RELEASE_TAG
echo "created/moved mutalbe tag $RELEASE_TAG to $GITHUB_SHA"
echo "MOVED_MUTABLE_TAG=true" >> $GITHUB_ENV
fi
else
echo "workflow triggered by $GITHUB_EVENT_NAME tag $RELEASE_TAG"
fi
- name: Exits the workflow if tag has been moved.
if: ${{ env.MOVED_MUTABLE_TAG == 'true' }}
# Exits the workflow if tag has been moved since creating/moving triggers another run of this workflow.
run: exit 0 # Exits the workflow with success

- name: Build source tarball
run: git archive --format=tar HEAD | gzip > archive.tgz

Expand Down

0 comments on commit f54ebaa

Please sign in to comment.