-
Notifications
You must be signed in to change notification settings - Fork 220
195 lines (169 loc) · 5.08 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
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
name: release
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v2
- name: Prevent from snapcraft fail
run: |
mkdir -p $HOME/.cache/snapcraft/download
mkdir -p $HOME/.cache/snapcraft/stage-packages
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: 'v2.4.6'
args: release --clean --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
- name: Preserve artifacts permissions with tar
run: tar -cvf dist.tar dist/
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist.tar
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/download-artifact@v4
with:
name: dist
- run: tar -xvf dist.tar
- name: Publish to NPM
env:
NPM_API_KEY: ${{ secrets.NPM_API_KEY }}
run: |
cat << EOF > ~/.npmrc
//registry.npmjs.org/:_authToken=${NPM_API_KEY}
EOF
chmod 0600 ~/.npmrc
cd packaging/
ruby pack.rb prepare
ruby pack.rb publish_npm
publish-gem:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/download-artifact@v4
with:
name: dist
- run: tar -xvf dist.tar
- name: Publish to Rubygems
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
mkdir -p ~/.gem/
cat << EOF > ~/.gem/credentials
---
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
cd packaging/
ruby pack.rb prepare
ruby pack.rb publish_gem
publish-pypi:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/download-artifact@v4
with:
name: dist
- run: tar -xvf dist.tar
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: python -m pip install --upgrade pip twine wheel setuptools
- name: Publish to PyPI
env:
PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }}
run: |
cat << EOF > ~/.pypirc
[distutils]
index-servers =
lefthook
[lefthook]
repository = https://upload.pypi.org/legacy/
username = __token__
password = ${PYPI_API_KEY}
EOF
chmod 0600 ~/.pypirc
cd packaging/
ruby pack.rb prepare
ruby pack.rb publish_pypi
publish-homebrew:
needs: build
runs-on: ubuntu-latest
steps:
- name: Update Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
formula: lefthook
token: ${{ secrets.HOMEBREW_TOKEN }}
publish-winget:
needs: build
runs-on: ubuntu-latest
steps:
- name: Publish to Winget
uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: evilmartians.lefthook
fork-user: mrexox
token: ${{ secrets.WINGET_TOKEN }}
publish-distro-packages:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: dist
- run: tar -xvf dist.tar
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: python -m pip install --upgrade cloudsmith-cli
- name: Push packages to Cloudsmith
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: |
cloudsmith push deb evilmartians/lefthook/any-distro/any-version dist/lefthook_*_amd64.deb
cloudsmith push deb evilmartians/lefthook/any-distro/any-version dist/lefthook_*_arm64.deb
cloudsmith push rpm evilmartians/lefthook/any-distro/any-version dist/lefthook_*_amd64.rpm
cloudsmith push rpm evilmartians/lefthook/any-distro/any-version dist/lefthook_*_arm64.rpm
cloudsmith push alpine evilmartians/lefthook/alpine/any-version dist/lefthook_*_amd64.apk
cloudsmith push alpine evilmartians/lefthook/alpine/any-version dist/lefthook_*_arm64.apk