-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (134 loc) · 4.03 KB
/
release.yml
File metadata and controls
159 lines (134 loc) · 4.03 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
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
bump-versions:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Bump versions and push
run: make bump-version VERSION="$VERSION" COMMIT=true
build-vsix:
needs: [bump-versions]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install extension dependencies
working-directory: src/Napper.VsCode
run: npm ci
- name: Compile extension
working-directory: src/Napper.VsCode
run: npx webpack --mode production
- name: Package universal VSIX
working-directory: src/Napper.VsCode
run: npx @vscode/vsce package --no-dependencies --skip-license
- name: Upload VSIX
uses: actions/upload-artifact@v4
with:
name: vsix
path: src/Napper.VsCode/*.vsix
build-cli:
needs: [bump-versions]
strategy:
matrix:
include:
- rid: osx-arm64
asset: napper-osx-arm64
- rid: osx-x64
asset: napper-osx-x64
- rid: linux-x64
asset: napper-linux-x64
- rid: win-x64
asset: napper-win-x64.exe
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Publish CLI (${{ matrix.rid }})
run: |
dotnet publish src/Napper.Cli/Napper.Cli.fsproj \
-r ${{ matrix.rid }} \
--self-contained \
-p:PublishTrimmed=true \
-p:PublishSingleFile=true \
-o out/${{ matrix.rid }} \
--nologo
- name: Prepare asset
run: |
if [ "${{ matrix.rid }}" = "win-x64" ]; then
mv out/${{ matrix.rid }}/napper.exe ${{ matrix.asset }}
else
mv out/${{ matrix.rid }}/napper ${{ matrix.asset }}
chmod +x ${{ matrix.asset }}
fi
- name: Upload CLI binary
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.rid }}
path: ${{ matrix.asset }}
publish-nuget:
needs: [bump-versions]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Pack dotnet tool
run: |
dotnet pack src/Napper.Cli/Napper.Cli.fsproj \
-c Release \
-p:Version=${{ env.VERSION }} \
--nologo
- name: Push to NuGet
run: |
dotnet nuget push src/Napper.Cli/nupkg/napper.${{ env.VERSION }}.nupkg \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json
release:
needs: [build-vsix, build-cli, publish-nuget]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: assets
merge-multiple: true
- name: Generate SHA256 checksums
working-directory: assets
run: sha256sum * > ../checksums-sha256.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
assets/*
checksums-sha256.txt