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 b48e0a1 commit be477a7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Nightly Build
on:
schedule:
- cron: '0,15,30,45 * * * * *' # This schedule runs every night at midnight UTC
push:
tags:
- "v*.*.*"

jobs:
nightly:
Expand All @@ -16,26 +19,34 @@ jobs:

- name: Prepare release body
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/(.*) ]]; then
RELEASE_TAG=${BASH_REMATCH[1]}
else
RELEASE_TAG=nightly
fi
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
RELEASE_DATETIME=$(date --rfc-3339=seconds)
cat <<EOF > release_template.md
Release created at $RELEASE_DATETIME
Release $RELEASE_TAG created from $GITHUB_SHA at $RELEASE_DATETIME
EOF
envsubst < release_template.md > release_body.md
- name: Build source tarball
run: git archive --format=tar HEAD | gzip > archive.tgz

- name: Remove existing tag
- name: Remove existing mutalbe tag "nightly"
# 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"

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

0 comments on commit be477a7

Please sign in to comment.