-
Notifications
You must be signed in to change notification settings - Fork 4
185 lines (164 loc) · 7.03 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
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
name: Release
on:
push:
tags:
- "v*.*.*"
env:
main_project_name: SpotifySongTagger
application_name: SongTaggerForSpotify
updater_name: Updater
api_name: BackendAPI
build_config: Release
# if this is devenv.exe instead it will not terminate
# on windows-2022 this has another path and also doesn't terminate
MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.com
jobs:
update_version_in_source:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# prepare version update
- name: extract tag
uses: olegtarasov/get-tag@v2.1
id: tagName
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
# update versions locally
- name: update application version
run: python .buildscripts/update_version_csproj.py --tagname ${{ steps.tagName.outputs.tag }} --project-file ${{ env.main_project_name }}/${{ env.main_project_name }}.csproj
- name: update updater version
run: python .buildscripts/update_version_csproj.py --tagname ${{ steps.tagName.outputs.tag }} --project-file ${{ env.updater_name }}/${{ env.updater_name }}.csproj
- name: update installer version
run: python .buildscripts/update_version_vdproj.py --tagname ${{ steps.tagName.outputs.tag }} --project-file Setup/Setup.vdproj
# push updated version
- name: push updated version number
uses: test-room-7/action-update-file@v1
with:
file-path: |
${{ env.main_project_name }}/${{ env.main_project_name }}.csproj
${{ env.updater_name }}/${{ env.updater_name }}.csproj
Setup/Setup.vdproj
commit-msg: update version number
github-token: ${{ secrets.GITHUB_TOKEN }}
# create empty release
- name: create empty release
uses: softprops/action-gh-release@v1
create_release_portable:
needs: update_version_in_source
runs-on: windows-latest
strategy:
matrix:
include:
- name: windows
asset_identifier: "-Windows"
RID: win-x64
# while .net 5 can run on everything, running WPF complicates this a bunch
# so it was omitted
#- name: Linux
# asset_identifier: "Linux"
# RID: linux-x64
#- name: Mac
# asset_identifier: "Mac"
# RID: osx-x64
steps:
- name: checkout
uses: actions/checkout@v2
# for some reason the checkout checks out the old commit without version update (even with provided SHA)
# prepare version update
- name: extract tag
uses: olegtarasov/get-tag@v2.1
id: tagName
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
# update versions locally
- name: update application version
run: python .buildscripts/update_version_csproj.py --tagname ${{ steps.tagName.outputs.tag }} --project-file ${{ env.main_project_name }}/${{ env.main_project_name }}.csproj
- name: update updater version
run: python .buildscripts/update_version_csproj.py --tagname ${{ steps.tagName.outputs.tag }} --project-file ${{ env.updater_name }}/${{ env.updater_name }}.csproj
# setup runtime
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
# publish program to {application_name}/{matrix.name}
- name: publish program ${{ matrix.name }}
run: dotnet publish ${{ env.main_project_name }} --configuration ${{ env.build_config }} -o "${{ env.application_name }}/${{ matrix.name }}" -r ${{ matrix.RID }} --no-self-contained
# publish updater to {application_name}/{matrix.name}
- name: publish updater ${{ matrix.name }}
run: dotnet publish ${{ env.updater_name }} --configuration ${{ env.build_config }} -o "${{ env.application_name }}/${{ matrix.name }}" -r ${{ matrix.RID }} --no-self-contained
# publish API to {application_name}/{matrix.name}
- name: publish API ${{ matrix.name }}
run: dotnet publish ${{ env.api_name }} --configuration ${{ env.build_config }} -o "${{ env.application_name }}/${{ matrix.name }}" -r ${{ matrix.RID }} --no-self-contained
# zip {application_name}/{matrix.name} into a zip file where the root folder has name {application_name}
- name: zip portable build
uses: vimtor/action-zip@v1
with:
files: "${{ env.application_name }}/${{ matrix.name }}"
dest: "Releases/${{ env.application_name }}-${{ matrix.name }}.zip"
recursive: false
# get release.upload_url
- name: get release.upload_url
id: update_release
uses: tubone24/update_release@v1.0
env:
GITHUB_TOKEN: ${{ github.token }}
# add zip to release assets
- name: add ${{ matrix.name }} to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
upload_url: ${{ steps.update_release.outputs.upload_url }}
asset_path: ./Releases/${{ env.application_name }}-${{ matrix.name }}.zip
asset_name: ${{ env.application_name }}${{ matrix.asset_identifier }}.zip
asset_content_type: application/zip
create_release_installer:
needs: update_version_in_source
# devenv.com doesn't terminate on windows-latest for some reason
runs-on: windows-2019
steps:
- name: checkout
uses: actions/checkout@v2
# for some reason the checkout checks out the old commit without version update (even with provided SHA)
# prepare version update
- name: extract tag
uses: olegtarasov/get-tag@v2.1
id: tagName
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
# update versions locally
- name: update installer version
run: python .buildscripts/update_version_vdproj.py --tagname ${{ steps.tagName.outputs.tag }} --project-file Setup/Setup.vdproj
# setup runtime
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
# publish setup project to Setup/{build_config}
- name: publish setup
shell: cmd
run: |
"%MSBUILD_PATH%" ${{ env.main_project_name }}_minimal.sln /Project Setup/Setup.vdproj /Build ${{ env.build_config }}
# get release.upload_url
- name: get release.upload_url
id: update_release
uses: tubone24/update_release@v1.0
env:
GITHUB_TOKEN: ${{ github.token }}
# add msi to release assets
- name: add ${{ matrix.name }} to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
upload_url: ${{ steps.update_release.outputs.upload_url }}
asset_path: ./Setup/${{ env.build_config }}/Setup.msi
asset_name: ${{ env.application_name }}-Windows-Installer.msi
asset_content_type: application/octet-stream