diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b25ea1..496282f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: @@ -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 < release_template.md Release $RELEASE_TAG created from $GITHUB_SHA at $RELEASE_DATETIME @@ -38,7 +41,7 @@ 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 @@ -46,7 +49,7 @@ jobs: 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: |