-
Notifications
You must be signed in to change notification settings - Fork 19
204 lines (201 loc) · 6.61 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
196
197
198
199
200
201
202
203
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
jobs:
convert-release-as-draft:
name: Convert release to draft
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: chmod +x .hacking/scripts/convert_release_to_draft.sh
- run: .hacking/scripts/convert_release_to_draft.sh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check-versions-match:
name: Check versions match
runs-on: ubuntu-latest
needs:
- convert-release-as-draft
steps:
- uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install jq
- name: Allow running check_versions_match.sh
run: chmod +x ./.hacking/scripts/check_versions_match.sh
- name: Check release version matches code
run: |
RELEASE_VERSION=${{ github.event.release.tag_name }}
STRIPPED_VERSION=${RELEASE_VERSION#v}
./.hacking/scripts/check_versions_match.sh $STRIPPED_VERSION
release-vsix:
name: Release VSIX
runs-on: ubuntu-latest
needs:
- check-versions-match
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false
- name: Install Nodejs
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- uses: dtolnay/rust-toolchain@stable
- run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- run: cd editors/code && pnpm run build
- run: cd editors/code && pnpm run package
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
editors/code/*.vsix
release:
name: Release ${{ matrix.platform.target }}
runs-on: ${{ matrix.platform.os }}
needs:
- check-versions-match
strategy:
fail-fast: false
matrix:
platform:
- name: sqruff-linux-x86_64-musl.tar.gz
os: ubuntu-20.04
target: x86_64-unknown-linux-musl
bin: sqruff
- name: sqruff-linux-aarch64-musl.tar.gz
os: ubuntu-20.04
target: aarch64-unknown-linux-musl
bin: sqruff
- name: sqruff-windows-x86_64.zip
os: windows-latest
target: x86_64-pc-windows-msvc
bin: sqruff.exe
- name: sqruff-darwin-x86_64.tar.gz
os: macos-13
target: x86_64-apple-darwin
bin: sqruff
- name: sqruff-darwin-aarch64.tar.gz
os: macOS-latest
target: aarch64-apple-darwin
bin: sqruff
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
if: contains(matrix.platform.name, 'musl')
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
target: ${{ matrix.platform.target }}
toolchain: stable
args: --locked --release
strip: true
- name: Package as archive
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
else
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
fi
cd -
- name: Generate SHA-256 and Save to File
run: shasum -a 256 ${{ matrix.platform.name }} > ${{ matrix.platform.name }}.sha256
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
sqruff-*
convert_release_to_not_draft:
name: Convert release to not draft
runs-on: ubuntu-latest
permissions: write-all
needs:
- release
- release-vsix
steps:
- uses: actions/checkout@v4
- run: chmod +x ./.hacking/scripts/convert_release_to_not_draft.sh
- run: ./.hacking/scripts/convert_release_to_not_draft.sh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update-homebrew-formula:
name: Update Homebrew Formula
runs-on: ubuntu-latest
needs: [convert_release_to_not_draft]
permissions: write-all
env:
HOMEBREW_ACCESS_TOKEN: ${{ secrets.HOMEBREW_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v4
- run: ./.hacking/scripts/update_homebrew_pr.sh $HOMEBREW_ACCESS_TOKEN
publish-to-cargo:
name: Publish to Cargo
runs-on: ubuntu-latest
needs: [convert_release_to_not_draft]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Publish sqruff-lib-core to Cargo
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CARGO_API_TOKEN }} -p sqruff-lib-core
- name: Publish sqruff-lib-dialects to Cargo
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CARGO_API_TOKEN }} -p sqruff-lib-dialects
- name: Publish sqruff-lib to Cargo
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CARGO_API_TOKEN }} -p sqruff-lib
- name: Publish sqruff-lsp to Cargo
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CARGO_API_TOKEN }} -p sqruff-lsp
- name: Publish sqruff to Cargo
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CARGO_API_TOKEN }} -p sqruff
publish-to-marketplace:
name: Publish VSIX to VSCode Marketplace
runs-on: ubuntu-latest
needs:
- release-vsix
- convert_release_to_not_draft
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install vsce
run: npm install -g vsce
- run: chmod +x .hacking/scripts/download_extension.sh
- run: ./.hacking/scripts/download_extension.sh
- name: Publish to VSCode Marketplace
run: vsce publish --packagePath extension.vsix
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }} # Set up the VSCE Personal Access Token in GitHub secrets