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 64aeed4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Nightly Build

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

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
tag_name: ${{ env.PRE_RELEASE }}
# The body field does not support environment variable substitution directly.
body_path: release_body.md
files: |
Expand Down

0 comments on commit 64aeed4

Please sign in to comment.