From 4aed42ac37b29b1e9714ffe41aecc8f0875275b3 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Thu, 21 Mar 2024 16:03:53 -0400 Subject: [PATCH] SHIP-0038: Add Git Ref to Release Workflow Update the release workflow to accept a git reference as a parameter. This will be used to check out the appropriate release branch when generating artifacts and release notes. The workflow then creates a tag for the release, which is required by GoReleaser in a subsequent step. The action was also updated to use the (new?) inputs context, instead of relying on the inputs key existing in the github.events payload. --- .github/workflows/release.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad03531a5..749e0c2b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,9 @@ on: previous-tag: description: 'Previous release tag' required: true + git-ref: + description: 'Git reference for the release. Use an appropriate release-v* branch, tag, or commit SHA.' + required: true jobs: release: name: Release @@ -20,7 +23,7 @@ jobs: - name: Check out code uses: actions/checkout@v4 with: - ref: ${{ github.event.inputs.release }} + ref: ${{ inputs.git-ref }} fetch-depth: 0 - name: Install Go @@ -29,11 +32,20 @@ jobs: go-version: '1.19.x' cache: true check-latest: true + + - name: Tag release + run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git tag -a "${{ inputs.release }}" -m "Release ${{ inputs.release }}" --force + git push origin "${{ inputs.release }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build Release Changelog env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PREVIOUS_TAG: ${{ github.event.inputs.previous-tag }} + PREVIOUS_TAG: ${{ inputs.previous-tag }} # This creates a set of release notes at Changes.md run: | export GITHUB_TOKEN