Create workflow to automate future releases - #133
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #133 +/- ##
=======================================
Coverage 96.55% 96.55%
=======================================
Files 6 6
Lines 290 290
=======================================
Hits 280 280
Misses 8 8
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| echo "::error::Requested version ($input) does not match Version in secretcache/versionInfo.go ($repo)." | ||
| exit 1 | ||
| fi | ||
|
|
There was a problem hiding this comment.
Nit: Consider adding a check to make sure the requested new version is correct with respect to the previously released version. e.g. v3.1.0 -> v3.1.1 is fine, but v3.1.0 -> v3.2.1 is not.
There was a problem hiding this comment.
Why would the latter example you provided not be ok?
| exit 1 | ||
| fi | ||
|
|
||
| - name: Build |
There was a problem hiding this comment.
You can reuse existing workflows using workflow_call.
| echo "::error::Requested version ($input) does not match Version in secretcache/versionInfo.go ($repo)." | ||
| exit 1 | ||
| fi | ||
|
|
There was a problem hiding this comment.
Why would the latter example you provided not be ok?
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: "1.24" |
There was a problem hiding this comment.
Might want to go with "stable". Or follow the other comment and reuse the build workflow.
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
Gate this workflow on an environment so we can restrict this to running under a 2PR.
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 |
There was a problem hiding this comment.
For our release workflows we tie GitHub actions we use to a SHA hash. This is to prevent supply chain attacks.
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check tag does not already exist |
There was a problem hiding this comment.
Can we just attempt the push? It will fail if the tag already exists.
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| tag="v${{ github.event.inputs.version }}" | ||
| gh release create "$tag" \ |
There was a problem hiding this comment.
If a matching git tag does not yet exist, one will automatically get created from the latest state of the default branch. Use --target to point to a different branch or commit for the automatic tag creation. Use --verify-tag to abort the release if the tag doesn't already exist.
Description
Why is this change being made?
What is changing?
.github/workflows/release.yml, a manually-triggered(
workflow_dispatch) release job that takes aversioninput and:x.y.z);Versioninsecretcache/versionInfo.go;v<version>tag already exists (releases are immutable);go build ./...andgo test ./secretcache;Related Links
Testing
How was this tested?
When testing locally, provide testing artifact(s):
N/A — this is a GitHub Actions workflow and can't be run locally. It was validated by dispatching it on a forked mirror repo; see the run/release linked below.
This is an example workflow that was released on a forked version of the repository: https://github.com/SaiTejaKundety/aws-secretsmanager-caching-go-forked/actions/runs/31200227888/job/92938210279
Reviewee Checklist
Update the checklist after submitting the PR
If not, why:
If not, why:
If not, why:
If not, why:
If not, why:
If not, why: N/A
If not, why:
If not, why:
If not, why: N/A
If not, why: N/A
Reviewer Checklist
All reviewers please ensure the following are true before reviewing:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.