Skip to content

Commit

Permalink
SHIP-0038: Add Git Ref to Release Workflow
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adambkaplan committed Mar 21, 2024
1 parent ab4a919 commit 4aed42a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4aed42a

Please sign in to comment.