Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzhichang committed Dec 26, 2023
1 parent 7c7bfec commit c58fc0b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Nightly Build
name: release

on:
schedule:
- cron: '0,15,30,45 * * * * *' # This schedule runs every night at midnight UTC
- cron: '0,15,30,45 * * * *' # schedule nightly build daily at midnight UTC
push:
tags:
- "v*.*.*"
- "v*.*.*" # normal release

jobs:
nightly:
Expand All @@ -19,12 +19,15 @@ jobs:

- name: Prepare release body
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/(.*) ]]; then
RELEASE_TAG=${BASH_REMATCH[1]}
if [[ ${{ github.ref }} =~ ^refs/tags/v(.*) ]]; then
RELEASE_TAG=v${BASH_REMATCH[1]}
PRERELEASE=false
else
RELEASE_TAG=nightly
PRERELEASE=true
fi
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
RELEASE_DATETIME=$(date --rfc-3339=seconds)
cat <<EOF > release_template.md
Release $RELEASE_TAG created from $GITHUB_SHA at $RELEASE_DATETIME
Expand All @@ -38,15 +41,15 @@ jobs:
# https://github.com/softprops/action-gh-release/issues/171
run: git push origin :refs/tags/nightly || true
# https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution
if: $RELEASE_TAG == "nightly"
if: ${{ env.RELEASE_TAG }} == "nightly"

- name: Create or overwrite a releae
# https://github.com/actions/upload-release-asset has been replaced by https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.MY_GITHUB_TOKEN }} # Use the secret as an environment variable
prerelease: true
tag_name: $RELEASE_TAG
prerelease: ${{ env.PRE_RELEASE }}
tag_name: ${{ env.RELEASE_TAG }}
# The body field does not support environment variable substitution directly.
body_path: release_body.md
files: |
Expand Down

0 comments on commit c58fc0b

Please sign in to comment.