diff --git a/.github/workflows/release.yml b/.github/workflows/deploy-release.yml similarity index 99% rename from .github/workflows/release.yml rename to .github/workflows/deploy-release.yml index 6d978cf..22d6c99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/deploy-release.yml @@ -1,4 +1,4 @@ -name: Release +name: Deploy Release on: push: diff --git a/.github/workflows/tag.yml b/.github/workflows/tag-and-release.yml similarity index 62% rename from .github/workflows/tag.yml rename to .github/workflows/tag-and-release.yml index 8237bac..b7d61a7 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag-and-release.yml @@ -1,4 +1,4 @@ -name: Tag +name: Release on: workflow_dispatch: @@ -45,12 +45,23 @@ jobs: exit 1 fi - - name: Create and push annotated tag + - name: Create GitHub release and tag + # Creating the release with a PAT (not the default GITHUB_TOKEN) makes + # gh create the tag, which produces a tag-push event that triggers the + # Deploy Release workflow. Tags created with GITHUB_TOKEN do not trigger + # other workflows. + env: + GH_TOKEN: ${{ secrets.GH_PAT }} run: | TAG="${{ steps.ver.outputs.tag }}" SHA="$(git rev-parse HEAD)" - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git tag -a "$TAG" -m "$TAG" "$SHA" - git push origin "$TAG" - echo "Tagged $SHA as $TAG. Release workflow will run on the tag push." >> "$GITHUB_STEP_SUMMARY" + PRERELEASE_FLAG="" + if [[ "$TAG" =~ -([Rr][Cc]|beta|alpha) ]]; then + PRERELEASE_FLAG="--prerelease" + fi + gh release create "$TAG" \ + --title "$TAG" \ + --target "$SHA" \ + --generate-notes \ + $PRERELEASE_FLAG + echo "Created release $TAG at $SHA. Deploy Release workflow will run on the tag push." >> "$GITHUB_STEP_SUMMARY"