-
Notifications
You must be signed in to change notification settings - Fork 22
68 lines (59 loc) · 2.36 KB
/
Copy pathrelease.yml
File metadata and controls
68 lines (59 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Terraform Provider release workflow.
name: Release
# This GitHub action creates a release when a tag that matches the pattern
# "v*" (e.g. v0.1.0) is created.
on:
push:
tags:
- 'v*'
workflow_dispatch:
# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write
jobs:
goreleaser:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- name: Generate release notes
id: notes
env:
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
notes="${RUNNER_TEMP}/release-notes.md"
bash .github/scripts/generate-release-notes.sh "${{ github.ref_name }}" > "$notes"
echo "path=${notes}" >> "$GITHUB_OUTPUT"
echo "Release notes:"
cat "$notes"
- name: Update CHANGELOG
run: bash .github/scripts/update-changelog.sh "${{ github.ref_name }}" "${{ steps.notes.outputs.path }}"
- name: Commit CHANGELOG
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git diff --staged --quiet || git commit -m "docs: update CHANGELOG for ${{ github.ref_name }}"
git push origin HEAD:main
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
with:
args: release --clean --release-notes=${{ steps.notes.outputs.path }}
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}