Skip to content

Commit e8a0a77

Browse files
committed
tech: update release and prerelease workflows
1 parent 84adeeb commit e8a0a77

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

.github/workflows/prerelease.yml

+7-16
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v2
28-
29-
- name: Unshallow
30-
run: git fetch --prune --unshallow
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
token: ${{ secrets.GITHUB_TOKEN }}
3131

3232
- name: Setup Go
33-
uses: actions/setup-go@v2
33+
uses: actions/setup-go@v5
3434
with:
3535
cache: true
3636
go-version-file: 'go.mod'
3737
cache-dependency-path: go.sum
3838

3939
- name: Configure Git
4040
env:
41-
TOKEN: ${{ secrets.HCP_SDK_PIPELINE_TOKEN }}
41+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
4242
run: |
4343
git config --global advice.detachedHead false
4444
git config --global url."https://${TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
@@ -85,19 +85,10 @@ jobs:
8585
echo "New Version will be: $NEW_VERSION"
8686
echo "## Updating ${CURRENT_VERSION} to ${NEW_VERSION}" >> $GITHUB_STEP_SUMMARY
8787
88-
echo "## Diff from Prerelease tasks" >> $GITHUB_STEP_SUMMARY
89-
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY
90-
git diff @{upstream} @ >> $GITHUB_STEP_SUMMARY
91-
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
92-
echo "Diff from Prerelease tasks:"
93-
git diff @{upstream} @
94-
9588
- name: Release New Version
96-
if: success() && github.ref_name == 'main' && steps.changes.outputs.HAS_CHANGES == 'true' && ${{ !inputs.skip-release }}
89+
if: ${{ success() && github.ref_name == 'master' && steps.changes.outputs.HAS_CHANGES == 'true' && !inputs.skip-release }}
9790
run: |
9891
git tag -a ${NEW_VERSION} -m "New version ${NEW_VERSION}"
99-
echo "Git configuration:"
100-
git config -l
10192
echo "Pushing new tag to remote, which will trigger the Release workflow"
10293
git push --tags
10394

.github/workflows/release.yml

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,44 @@
11
# This GitHub action can publish assets for release when a tag is created.
22
name: release
3+
34
on:
5+
pull_request:
46
push:
7+
# run only against tags
58
tags:
6-
- 'v*'
9+
- "*"
10+
11+
permissions:
12+
contents: write
13+
714
jobs:
815
goreleaser:
916
runs-on: ubuntu-latest
1017
steps:
1118
- name: Checkout
12-
uses: actions/checkout@v2
13-
- name: Unshallow
14-
run: git fetch --prune --unshallow
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
1523
- name: Set up Go
16-
uses: actions/setup-go@v2
24+
uses: actions/setup-go@v4
1725
with:
1826
cache: true
1927
go-version-file: 'go.mod'
2028
cache-dependency-path: go.sum
21-
29+
2230
- name: Import GPG key
2331
id: import_gpg
24-
uses: paultyng/ghaction-import-gpg@v2.1.0
32+
uses: crazy-max/ghaction-import-gpg@v6
2533
env:
26-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
27-
PASSPHRASE: ${{ secrets.PASSPHRASE }}
34+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
35+
passphrase: ${{ secrets.PASSPHRASE }}
36+
2837
- name: Run GoReleaser
29-
uses: goreleaser/goreleaser-action@v2
38+
uses: goreleaser/goreleaser-action@v5
3039
with:
3140
version: latest
32-
args: release --rm-dist
41+
args: release --clean
3342
env:
3443
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
3544
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ checksum:
3030
algorithm: sha256
3131
signs:
3232
- artifacts: checksum
33+
cmd: gpg2
3334
args:
3435
- "--batch"
35-
- "--local-user"
36+
- "-u"
3637
- "{{ .Env.GPG_FINGERPRINT }}"
3738
- "--output"
3839
- "${signature}"

0 commit comments

Comments
 (0)