forked from openbao/openbao
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (138 loc) · 4.62 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Creates a GitHub Release.
# Workflow is manually run.
# Preselect branch or tag before running this workflow.
name: release
on:
workflow_dispatch:
inputs:
prerelease:
description: "Mark this release as a prerelease"
required: false
default: "auto"
type: choice
# auto follows semver. Prerelease versions are hyphenated with a label. ex. 0.0.0-alpha, 1.0.0-rc1
options:
- auto
- "true"
- "false"
make-latest:
description: "Latest release"
required: false
default: true
type: boolean
permissions:
contents: write
id-token: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
strategy:
matrix:
release_os:
- linux
- darwin
- freebsd
- illumos
- netbsd
- openbsd
- windows
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # Required by GoRelease
- name: Golang Setup
uses: ./.github/actions/set-up-go
- name: go-check
run: go version
# Supports syft/sbom generation
- uses: anchore/sbom-action/download-syft@v0
# Supports Buildx
- name: Qemu Setup
uses: docker/setup-qemu-action@v3
- name: Buildx Setup
uses: docker/setup-buildx-action@v3
- name: Cosign Install
uses: sigstore/cosign-installer@v3
- name: GPG Import
id: gpg-import
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSWORD }}
- name: Cache Setup
uses: actions/cache@v4
with:
path: |
./dist/**/bao
./dist/**/*.exe
./dist/**/*.deb
./dist/**/*.rpm
./dist/*.tar.gz
./dist/*.tar.gz.zst
./dist/*.zip
key: ${{ github.ref }}
- name: "Docker Login: ghcr.io"
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Docker Login: docker.io"
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: "Docker Login: quay.io"
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
# Needed for nPFM
- name: Create GPG Signing Key File
if: startsWith(github.ref, 'refs/tags/')
run: |
GPG_KEY_FILE=/tmp/signing-key.gpg
echo "${{ secrets.GPG_PRIVATE_KEY_BASE64 }}" | base64 -di > "${GPG_KEY_FILE}"
echo "GPG_KEY_FILE=${GPG_KEY_FILE}" >> "${GITHUB_ENV}"
env:
GPG_TTY: /dev/ttys000 # Set the GPG_TTY to avoid issues with pinentry
- name: "Template GoRelaser configuration"
if: startsWith(github.ref, 'refs/tags/')
run: |
sed "s/REPLACE_WITH_RELEASE_GOOS/${{ matrix.release_os }}/g" .goreleaser-template.yaml > .goreleaser.yaml
sed -i "s/^#OTHERARCH#//g" .goreleaser.yaml
[ "${{ matrix.release_os }}" == "linux" ] && sed -i "s/^#LINUXONLY#//g" .goreleaser.yaml || true
- name: "GoReleaser: Release"
if: startsWith(github.ref, 'refs/tags/')
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean --timeout=60m --verbose --parallelism 2
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.gpg-import.outputs.fingerprint }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GITHUB_RELEASE_PRERELEASE: ${{ inputs.prerelease }}
GITHUB_RELEASE_MAKE_LATEST: ${{ inputs.make-latest }}
NFPM_DEFAULT_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}
- name: Remove GPG Signing Key File
if: always()
run: |
if [ -n "${GPG_KEY_FILE}" ]; then
rm -rf "${GPG_KEY_FILE}"
fi
- name: "Check free space on runner"
run: |
df -h .