-
Notifications
You must be signed in to change notification settings - Fork 5
87 lines (84 loc) · 2.92 KB
/
release.yml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: "Release"
on:
workflow_dispatch: {}
repository_dispatch:
types:
- release
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'true'
token: ${{ secrets.ORG_GITHUB_TOKEN }}
- name: Fetch All Tags
run: git fetch --force --tags
- name: Determine Next Version
id: next_version
uses: zwaldowski/semver-release-action@v3
with:
dry_run: true
bump: "patch"
prefix: "v"
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: Ensure Changelog
run: |
if test -f ./.changes/${{ steps.next_version.outputs.version_tag }}.md
then
echo "Skip Changie..."
else
go install github.com/miniscruff/changie@latest
changie batch ${{ steps.next_version.outputs.version_tag }}
changie merge
fi
- name: Generate Terraform Docs
run: |
go get github.com/hashicorp/[email protected]
go get github.com/hashicorp/terraform-plugin-docs/internal/[email protected]
go generate
- name: Commit & Tag Release
run: |
git config user.name "OpsLevel Bots"
git config user.email "[email protected]"
if [[ $(git diff --stat) != '' ]];
then
git add .
git commit -m "Cut Release '${{ steps.next_version.outputs.version_tag }}'"
git push origin HEAD
else
echo "Skip commit"
fi
git tag -f ${{ steps.next_version.outputs.version_tag }} -m "Cut Release '${{ steps.next_version.outputs.version_tag }}'"
git push -f origin refs/tags/${{ steps.next_version.outputs.version_tag }}
- name: Ensure Release Does Not Exist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete ${{ steps.next_version.outputs.version_tag }} || true
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
args: release --rm-dist --release-notes=./.changes/${{ steps.next_version.outputs.version_tag }}.md
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Report Release To OpsLevel
uses: opslevel/[email protected]
with:
integration_url: ${{ secrets.DEPLOY_INTEGRATION_URL }}
service: "opslevel_terraform_provider"