-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (77 loc) · 3.21 KB
/
release.yml
File metadata and controls
81 lines (77 loc) · 3.21 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
69
70
71
72
73
74
75
76
77
78
79
80
81
---
# 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*'
# 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:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5 # v4.2.2
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with:
args: release --clean --release-notes=CHANGELOG.md
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Notify Slack of release (success)
if: ${{ success() }}
uses: slackapi/slack-github-action@v2.1.1
with:
webhook: "${{ secrets.SLACK_WEBHOOK_URL }}"
webhook-type: "incoming-webhook"
payload: |
text: ":white_check_mark: *Terraform Provider Release Succeeded!*"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: |
:white_check_mark: *Terraform Provider Release* succeeded!
*Tag pushed:* `${{ github.ref_name }}`
*Repository:* <https://github.com/${{ github.repository }}|${{ github.repository }}>
*Commit:* <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>
*Actor:* `${{ github.actor }}`
*Workflow:* `${{ github.workflow }}`
- name: Notify Slack of release (failure)
if: ${{ failure() }}
uses: slackapi/slack-github-action@v2.1.1
with:
webhook: "${{ secrets.SLACK_WEBHOOK_URL }}"
webhook-type: "incoming-webhook"
payload: |
text: ":x: *Terraform Provider Release Failed!*"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: |
:x: *Terraform Provider Release* failed.
*Tag pushed:* `${{ github.ref_name }}`
*Repository:* <https://github.com/${{ github.repository }}|${{ github.repository }}>
*Commit:* <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>
*Actor:* `${{ github.actor }}`
*Workflow:* `${{ github.workflow }}`