-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (85 loc) · 2.77 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
---
name: semantic-release
on:
workflow_run:
workflows: [pre-commit]
types: [completed]
branches: [master]
jobs:
semantic-release:
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
runs-on: ubuntu-latest
container:
image: node:lts-alpine3.19
env:
NPM_CACHE_DIR: ~/.cache/npm
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Install job dependencies
run: apk add tar git gpg gpg-agent cosign
- name: Import GPG key
run: |
echo -n "${{ secrets.GPG_PRIVATE_KEY }}" > key.gpg
- uses: actions/cache@v4
with:
path: ~/.cache
key: semantic-release
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install semantic-release and plugins
run: npm install --cache $NPM_CACHE_DIR
semantic-release
@semantic-release/github
@semantic-release/changelog
@semantic-release/git
@semantic-release/exec
conventional-changelog-conventionalcommits
- name: Run semantic-release
run: |
git config --global --add safe.directory $PWD
npx semantic-release
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_PASSWORD: ${{ secrets.PASSPHRASE }}
gorelease:
needs: semantic-release
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
runs-on: ubuntu-latest
container:
image: goreleaser/goreleaser
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run GoReleaser
run: |
cd ${GITHUB_WORKSPACE}
echo -n "${{ secrets.GPG_PRIVATE_KEY }}" > key.gpg
goreleaser release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_PASSWORD: ${{ secrets.PASSPHRASE }}