-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (114 loc) · 3.89 KB
/
release.yaml
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
name: Build nightly release
permissions:
contents: write
on:
release:
types: [ published ]
jobs:
build-server:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check git version matches flake version
shell: bash
run: |
if ! [ $(echo '${{ github.ref }}' | cut -d'v' -f 2) = $(grep '# CI:CD-VERSION$' flake.nix | cut -d'"' -f 2) ];
then
echo "Version mismatch between Git and flake"
exit 1
fi
- name: Check version in code matches flake version
shell: bash
run: |
if ! [ $(grep '// CI:CD-VERSION$' server/root-handler/handler.go | cut -d'"' -f 2) = $(grep '# CI:CD-VERSION$' flake.nix | cut -d'"' -f 2) ];
then
echo "Version mismatch between code and flake"
exit 1
fi
- name: Check vs code package.json version matches flake version
shell: bash
run: |
if ! [ $(grep '"version": "' vs-code-extension/package.json | cut -d'"' -f 4) = $(grep '# CI:CD-VERSION$' flake.nix | cut -d'"' -f 2) ];
then
echo "Version mismatch between vs code package.json and flake"
exit 1
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_CONFIGLSP_TOKEN }}
build-extension:
name: Build extension for ${{ matrix.target }}
runs-on: ubuntu-latest
needs:
# Wait for server to build so that we know the checks have passed
- build-server
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
vscode_target: linux-x64
- goos: linux
goarch: arm64
vscode_target: linux-arm64
- goos: darwin
goarch: amd64
vscode_target: darwin-x64
- goos: darwin
goarch: arm64
vscode_target: darwin-arm64
- goos: windows
goarch: amd64
vscode_target: win32-x64
- goos: windows
goarch: arm64
vscode_target: win32-arm64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Create bare extension
run: nix build .#"vs-code-extension-bare"
- name: Build extension
run: cd server && GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -a -gcflags=all="-l -B" -ldflags="-s -w" -o config-lsp
- name: Prepare folder
run: cp -rL result dist && chmod -R 777 dist
- name: Move binary to extension
run: mv server/config-lsp dist/out/
- name: Shrink binary
if: ${{ matrix.goos == 'linux' }}
run: nix develop .#"vs-code-extension" --command bash -c "upx dist/out/config-lsp"
- name: Package extension
run: nix develop .#"vs-code-extension" --command bash -c "cd dist && vsce package --target ${{ matrix.vscode_target }}"
- name: Move vsix to root
run: mv dist/*.vsix .
- uses: softprops/action-gh-release@v2
with:
files: '*.vsix'
- name: Set .env
run: |
touch .env
echo "VSCE_PAT=${{ secrets.VSCE_PAT }}" >> .env
- name: Upload extension to VS Code Marketplace
run: nix develop .#"vs-code-extension" --command bash -c "source .env && vsce publish --packagePath *.vsix"