From b20dd73b30b80084c7db8e9d12947b8be24797a8 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Mon, 18 Oct 2021 00:16:34 -0400 Subject: [PATCH] actions: Add brand new workflows - creating and announcing the releases --- .github/workflows/release-announce.yml | 23 +++++++ .../workflows/release-push-tag-and-draft.yml | 61 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 .github/workflows/release-announce.yml create mode 100644 .github/workflows/release-push-tag-and-draft.yml diff --git a/.github/workflows/release-announce.yml b/.github/workflows/release-announce.yml new file mode 100644 index 0000000000..9aabfed0a7 --- /dev/null +++ b/.github/workflows/release-announce.yml @@ -0,0 +1,23 @@ +name: 📢 Announce Release + +on: + release: + types: [published] + +jobs: + announce: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Announce Release + env: + DISCORD_BUILD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }} + run: | + cd ./.github/workflows/scripts/releases/announce-release + npm ci + node index.js diff --git a/.github/workflows/release-push-tag-and-draft.yml b/.github/workflows/release-push-tag-and-draft.yml new file mode 100644 index 0000000000..6a3247910c --- /dev/null +++ b/.github/workflows/release-push-tag-and-draft.yml @@ -0,0 +1,61 @@ +# Whenever a commit is pushed to master (ideally via a pull-request!) +# this action will create the next release, which means: +# 1. tag master with the proper semver +# 2. create a new draft release (pre-released if a nightly build) +# 3. add release notes + +name: 🏭 Create Release + +on: + push: + branches: + - master + # TODO - future work + # workflow_dispatch: + # inputs: + # isStable: + # description: 'Should it be a stable release?' + # required: true + # default: 'false' + # semverTag: + # description: 'The semantic version to tag with' + # required: true + +jobs: + cut-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + # Docs - https://github.com/mathieudutour/github-tag-action + # Workflows cannot trigger other workflows implicitly + # - https://github.community/t/github-actions-workflow-not-triggering-with-tag-push/17053/7 + - name: Bump SemVer and Push Tag + id: tag_version + uses: mathieudutour/github-tag-action@v5.6 + with: + github_token: ${{ secrets.BOT_PAT }} + tag_prefix: v + default_bump: patch + + # Generate the Release Notes + - name: Generate Release Notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMMIT_SHA: ${{ github.SHA }} + run: | + cd ./.github/workflows/scripts/releases/generate-release-notes + npm ci + node index.js + mv ./release-notes.md ${GITHUB_WORKSPACE}/release-notes.md + ls + + # Docs - https://github.com/softprops/action-gh-release + - name: Create a GitHub Release + uses: softprops/action-gh-release@v1 + if: steps.tag_version.outputs.new_tag + with: + body_path: ./release-notes.md + draft: true + prerelease: true + tag_name: ${{ steps.tag_version.outputs.new_tag }}