-
Notifications
You must be signed in to change notification settings - Fork 11
232 lines (225 loc) · 7.7 KB
/
publish.yml
File metadata and controls
232 lines (225 loc) · 7.7 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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Publish scrt
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
release:
runs-on: ubuntu-latest
permissions: {}
steps:
- name: scrt get DOCKERHUB_USERNAME
id: scrt-dockerhub-username
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: DOCKERHUB_USERNAME
- name: scrt get DOCKERHUB_TOKEN
id: scrt-dockerhub-token
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: DOCKERHUB_TOKEN
- name: scrt get GPG_KEY
id: scrt-gpg-key
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: GPG_KEY
- name: scrt get PUBLISH_GITHUB_TOKEN
id: scrt-publish-github-token
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: PUBLISH_GITHUB_TOKEN
- name: scrt get NFPM_LINUX_PACKAGES_PASSPHRASE
id: scrt-nfpm-linux-packages-passphrase
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: NFPM_LINUX_PACKAGES_PASSPHRASE
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: 1.18
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ steps.scrt-dockerhub-username.outputs.secret }}
password: ${{ steps.scrt-dockerhub-token.outputs.secret }}
- name: Checkout
uses: actions/checkout@v3
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Create key file
run: 'echo "${{ steps.gpg-key.outputs.secret }}" > key.gpg'
- name: Create release notes
run: sed -n "/^## ${GITHUB_REF_NAME:1}/,/^##[^#]/p" CHANGELOG.md | sed '$d' > release_notes.md
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist --release-notes=release_notes.md
env:
GITHUB_TOKEN: ${{ steps.scrt-publish-github-token.outputs.secret }}
NFPM_LINUX_PACKAGES_PASSPHRASE: ${{ steps.scrt-nfpm-linux-packages-passphrase.outputs.secret }}
- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
publish-apt:
runs-on: ubuntu-latest
permissions: {}
needs:
- release
steps:
- name: scrt get GPG_KEY
id: scrt-gpg-key
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: GPG_KEY
- name: scrt get PUBLISH_GITHUB_TOKEN
id: scrt-publish-github-token
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: PUBLISH_GITHUB_TOKEN
- name: scrt get NFPM_LINUX_PACKAGES_PASSPHRASE
id: scrt-nfpm-linux-packages-passphrase
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: NFPM_LINUX_PACKAGES_PASSPHRASE
- name: Checkout
uses: actions/checkout@v3
- name: Install tools
run: sudo apt update && sudo apt install -y git gnupg apt-utils dpkg-dev
- name: Download release artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Create key file
run: 'echo "${{ steps.gpg-key.outputs.secret }}" > key.gpg'
- name: Publish to apt repository
run: .scripts/publish_apt
env:
KEY_FILE: key.gpg
PASSPHRASE: ${{ steps.scrt-nfpm-linux-packages-passphrase.outputs.secret }}
GITHUB_TOKEN: ${{ steps.scrt-publish-github-token.outputs.secret }}
APT_REPOSITORY: loderunner/scrt-apt
DEST_DIR: ${{ runner.temp }}/scrt-apt
SIG_EMAIL: scrt@scrt.run
GIT_AUTHOR_NAME: 'Charles Francoise'
GIT_AUTHOR_EMAIL: scrt@scrt.run
GIT_COMMITTER_NAME: 'Charles Francoise'
GIT_COMMITTER_EMAIL: scrt@scrt.run
publish-yum:
runs-on: ubuntu-18.04 # createrepo is missing in Ubuntu 20.04 / restored in 22
permissions: {}
needs:
- release
steps:
- name: scrt get GPG_KEY
id: scrt-gpg-key
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: GPG_KEY
- name: scrt get PUBLISH_GITHUB_TOKEN
id: scrt-publish-github-token
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: PUBLISH_GITHUB_TOKEN
- name: scrt get NFPM_LINUX_PACKAGES_PASSPHRASE
id: scrt-nfpm-linux-packages-passphrase
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: NFPM_LINUX_PACKAGES_PASSPHRASE
- name: Checkout
uses: actions/checkout@v3
- name: Install tools
run: sudo apt update && sudo apt install -y git gnupg createrepo
- name: Download release artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Create key file
run: 'echo "${{ steps.gpg-key.outputs.secret }}" > key.gpg'
- name: Publish to yum repository
run: .scripts/publish_yum
env:
KEY_FILE: key.gpg
PASSPHRASE: ${{ steps.scrt-nfpm-linux-packages-passphrase.outputs.secret }}
GITHUB_TOKEN: ${{ steps.scrt-publish-github-token.outputs.secret }}
YUM_REPOSITORY: loderunner/scrt-yum
DEST_DIR: ${{ runner.temp }}/scrt-yum
SIG_EMAIL: scrt@scrt.run
GIT_AUTHOR_NAME: 'Charles Francoise'
GIT_AUTHOR_EMAIL: scrt@scrt.run
GIT_COMMITTER_NAME: 'Charles Francoise'
GIT_COMMITTER_EMAIL: scrt@scrt.run
dockerhub-description:
runs-on: ubuntu-latest
permissions: {}
needs:
- release
steps:
- name: scrt get DOCKERHUB_USERNAME
id: scrt-dockerhub-username
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: DOCKERHUB_USERNAME
- name: scrt get DOCKERHUB_TOKEN
id: scrt-dockerhub-token
uses: ./.github/actions/scrt
with:
password: ${{ secrets.SCRT_PASSWORD }}
key: DOCKERHUB_TOKEN
- name: Checkout
uses: actions/checkout@v3
- name: Push description to Docker Hub
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ steps.scrt-dockerhub-username.outputs.secret }}
password: ${{ steps.scrt-dockerhub-password.outputs.secret }}
repository: loderunner/scrt
readme-filepath: ./DOCKER.md
publish-docs:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- release
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: ./.github/actions/setup
- name: Build static website
working-directory: docs
run: npm run build
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: 'gh-pages'
path: 'gh-pages'
- name: Rsync built pages
run: rsync -avh --delete --exclude CNAME docs/.vuepress/dist/ gh-pages/docs/
- name: Push website to Github
working-directory: 'gh-pages'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update documentation"
git push