-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (125 loc) · 4.06 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
name: Release
on:
push:
tags:
- 'v*.*.*' # Matches tags like v1.0.0, v2.0.0, etc., but not pre-releases
permissions:
contents: write
env:
FETCH_DEPTH: 0 # pull in the tags for the version string
jobs:
package:
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: amd64
code-target: linux-x64
- os: ubuntu-latest
platform: linux
arch: arm64
code-target: linux-arm64
- os: macos-latest
platform: darwin
arch: amd64
code-target: darwin-x64
- os: macos-latest
platform: darwin
arch: arm64
code-target: darwin-arm64
- os: windows-latest
platform: windows
arch: amd64
code-target: win32-x64
- os: windows-latest
platform: windows
arch: arm64
code-target: win32-arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Determine treefmt version and filename
id: determine-version
shell: bash
run: |
echo "PRERELEASE=false" >> $GITHUB_ENV
case "${{ matrix.platform }}-${{ matrix.arch }}" in
"linux-amd64") FILENAME="treefmt-x86_64-unknown-linux-gnu.tar.gz";;
"linux-arm64") FILENAME="treefmt-aarch64-unknown-linux-musl.tar.gz";;
"darwin-amd64") FILENAME="treefmt-x86_64-apple-darwin.tar.gz";;
"darwin-arm64") FILENAME="treefmt-aarch64-apple-darwin.tar.gz";;
"windows-amd64") FILENAME="treefmt-x86_64-pc-windows-msvc.zip";;
"windows-arm64") FILENAME="treefmt-aarch64-pc-windows-msvc.zip";;
*) echo "Unsupported platform/arch combination" && exit 1;;
esac
echo "FILENAME=$FILENAME" >> $GITHUB_ENV
- name: Download treefmt
id: download-release
uses: robinraju/[email protected]
with:
repository: "numtide/treefmt"
latest: true
fileName: ${{ env.FILENAME }}
out-file-path: "downloads"
extract: true
- name: Rename treefmt binary
shell: bash
run: |
mkdir -p bin
if [[ "${{ matrix.platform }}" == 'windows' ]]; then
mv downloads/treefmt.exe bin/treefmt
else
mv downloads/treefmt bin/treefmt
fi
chmod +x bin/treefmt
- name: Install dependencies
run: npm ci
- name: Package Extension
run: npx vsce package -o "./treefmt-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
- name: Upload VSIX
uses: actions/upload-artifact@v4
with:
name: vsix-${{ matrix.platform }}-${{ matrix.arch }}
path: "./treefmt-${{ matrix.code-target }}.vsix"
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: package
steps:
- name: Download VSIX
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
treefmt-*.vsix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
name: Publish Extension
runs-on: ubuntu-latest
needs: package
steps:
- name: Download VSIX
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Publish to Marketplace
run: npx @vscode/vsce publish --packagePath treefmt-*.vsix --pat ${{ secrets.MARKETPLACE_TOKEN }}
# - name: Publish to OpenVSX
# run: npx ovsx publish --packagePath treefmt-*.vsix --pat ${{ secrets.OPENVSX_TOKEN }}
# timeout-minutes: 2