forked from wakatime/visualstudio-wakatime
-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (201 loc) · 6.67 KB
/
on_push.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
204
205
206
name: Release
on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize]
push:
branches: [master]
tags-ignore: ["**"]
jobs:
version:
name: Version
concurrency: tagging
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.format.outputs.semver }} # Without v prefix
semver_tag: ${{ steps.semver-tag.outputs.semver_tag }}
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Calculate semver tag
id: semver-tag
uses: gandarez/semver-action@master
with:
branching_model: trunk-based
prefix: ""
debug: true
-
name: Remove v prefix
id: format
run: |
echo "${{ steps.semver-tag.outputs.semver_tag }}"
ver=`echo "${{ steps.semver-tag.outputs.semver_tag }}" | sed 's/^v//'`
echo "$ver"
echo "semver=$ver" >> $GITHUB_OUTPUT
- name: Create tag
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.format.outputs.semver }}",
sha: context.sha
})
build-dev16:
name: Build Dev16
runs-on: windows-2019
# needs: [version]
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
-
name: Setup NuGet
uses: NuGet/setup-nuget@v1
-
name: Restore NuGet packages
run: nuget restore ./Dev16/Dev16.csproj -PackagesDirectory ./packages -NonInteractive
# -
# name: Update version
# run: |
# (Get-Content -Path Dev16\source.extension.vsixmanifest) |
# ForEach-Object {$_ -Replace '1.0.0', '${{ needs.version.outputs.semver }}'} |
# Set-Content -Path Dev16\source.extension.vsixmanifest
# (Get-Content -Path Dev16\Properties\AssemblyInfo.cs) |
# ForEach-Object {$_ -Replace '1.0.0', '${{ needs.version.outputs.semver }}'} |
# Set-Content -Path Dev16\Properties\AssemblyInfo.cs
-
name: Build Dev16 for Release
run: msbuild Dev16/Dev16.csproj -property:Configuration=Release -property:platform="AnyCPU"
-
name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: WakaTime.Dev16.vsix
path: Dev16/bin/Release/WakaTime.Dev16.vsix
# -
# name: Remove tag if failure
# if: ${{ failure() }}
# uses: actions/github-script@v7
# with:
# github-token: ${{ github.token }}
# script: |
# github.rest.git.deleteRef({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: "tags/${{ needs.version.outputs.semver }}"
# })
build-dev17:
name: Build Dev17
runs-on: windows-2019
needs: [version]
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
-
name: Setup NuGet
uses: NuGet/setup-nuget@v1
-
name: Restore NuGet packages
run: nuget restore ./Dev17/Dev17.csproj -PackagesDirectory ./packages -NonInteractive
-
name: Update version
run: |
(Get-Content -Path Dev17\source.extension.vsixmanifest) |
ForEach-Object {$_ -Replace '1.0.0', '${{ needs.version.outputs.semver }}'} |
Set-Content -Path Dev17\source.extension.vsixmanifest
(Get-Content -Path Dev17\Properties\AssemblyInfo.cs) |
ForEach-Object {$_ -Replace '1.0.0', '${{ needs.version.outputs.semver }}'} |
Set-Content -Path Dev17\Properties\AssemblyInfo.cs
-
name: Build Dev17 for Release
run: msbuild Dev17/Dev17.csproj -property:Configuration=Release -property:platform="x64" -property:DeployExtension=false
-
name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: WakaTime.Dev17.vsix
path: Dev17/bin/x64/Release/WakaTime.Dev17.vsix
-
name: Remove tag if failure
if: ${{ failure() }}
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/${{ needs.version.outputs.semver }}"
})
release:
name: Release
runs-on: windows-latest
# needs: [version, build-dev16, build-dev17]
needs: [build-dev16]
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: "*.vsix"
path: build/
- name: List files in the repository
run: |
ls -R ${{ github.workspace }}
- name: List files in vsix
run: |
ls -l ${{ github.workspace }}\build\WakaTime.Dev16.vsix
# -
# name: Publish Dev16 to Marketplace
# uses: cezarypiatek/[email protected]
# with:
# extension-file: ${{ github.workspace }}\build\WakaTime.Dev16.vsix
# publish-manifest-file: publishManifest.json
# personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }}
# -
# name: Publish Dev17 to Marketplace
# uses: cezarypiatek/[email protected]
# with:
# extension-file: ${{ github.workspace }}\build\WakaTime.Dev17.vsix
# publish-manifest-file: publishManifest.json
# personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }}
# -
# name: "Create release"
# uses: softprops/action-gh-release@master
# with:
# name: ${{ needs.version.outputs.semver }}
# tag_name: ${{ needs.version.outputs.semver }}
# target_commitish: ${{ github.sha }}
# draft: false
# files: ./build/*.vsix
# env:
# GITHUB_TOKEN: ${{ github.token }}
-
name: Remove tag if failure
if: ${{ failure() }}
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/${{ needs.version.outputs.semver }}"
})