-
Notifications
You must be signed in to change notification settings - Fork 64
148 lines (147 loc) · 6.12 KB
/
create-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
144
145
146
147
148
name: Create GitHub release
on:
push:
tags: ['v*']
jobs:
publish_binaries:
name: Publish binaries
runs-on: [windows-latest]
strategy:
matrix:
architecture:
- win-x64
- win-x86
- linux-x64
- linux-arm64
- osx-x64
env:
release: 'dev-proxy-${{ matrix.architecture }}-${{ github.ref_name }}'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Rename executable for beta
if: contains(github.ref_name, '-beta')
run: |
pushd
cd ./dev-proxy
$content = Get-Content dev-proxy.csproj
$content -replace '<AssemblyName>devproxy</AssemblyName>', '<AssemblyName>devproxy-beta</AssemblyName>' | Set-Content dev-proxy.csproj
popd
- name: Set newVersionNotification for beta
if: contains(github.ref_name, '-beta')
run: |
pushd
cd ./dev-proxy
$content = Get-Content devproxyrc.json
$content -replace '"newVersionNotification": "stable"', '"newVersionNotification": "beta"' | Set-Content devproxyrc.json
popd
- name: Publish ${{ matrix.architecture }}
run: dotnet publish ./dev-proxy/dev-proxy.csproj -c Release -p:PublishSingleFile=true -p:InformationalVersion=$("${{ github.ref_name }}".Substring(1)) -r ${{ matrix.architecture }} --self-contained -o ./${{ env.release }}
- name: Build plugins
run: dotnet build ./dev-proxy-plugins/dev-proxy-plugins.csproj -p:InformationalVersion=$("${{ github.ref_name }}".Substring(1)) -c Release -r ${{ matrix.architecture }} --no-self-contained
- name: Build abstractions
if: matrix.architecture == 'win-x64'
run: dotnet build ./dev-proxy-abstractions/dev-proxy-abstractions.csproj -p:InformationalVersion=$("${{ github.ref_name }}".Substring(1)) -c Release --no-self-contained
- name: Add plugins to output
run: cp ./dev-proxy/bin/Release/net9.0/${{ matrix.architecture }}/plugins ./${{ env.release }} -r
- name: Remove unnecessary files
run: |
pushd
cd ./${{ env.release }}
Get-ChildItem -Filter *.pdb -Recurse | Remove-Item
Get-ChildItem -Filter *.deps.json -Recurse | Remove-Item
Get-ChildItem -Filter *.runtimeconfig.json -Recurse | Remove-Item
popd
- name: Archive release ${{ env.release }}
uses: thedoctor0/zip-release@master
with:
filename: '../${{ env.release }}.zip'
directory: './${{ env.release }}'
- name: Release SHA256 hash
run: |
$(Get-FileHash ./${{ env.release }}.zip -Algorithm SHA256).Hash
- name: Upload release
uses: actions/upload-artifact@v4
with:
name: binaries-${{ env.release }}
path: ./${{ env.release }}.zip
- name: Archive abstractions
if: matrix.architecture == 'win-x64'
uses: thedoctor0/zip-release@master
with:
filename: '../../../../dev-proxy-abstractions-${{ github.ref_name }}.zip'
directory: './dev-proxy-abstractions/bin/Release/net9.0'
exclusions: '*.json'
- name: Upload abstractions
if: matrix.architecture == 'win-x64'
uses: actions/upload-artifact@v4
with:
name: binaries-dev-proxy-abstractions-${{ github.ref_name }}
path: ./dev-proxy-abstractions-${{ github.ref_name }}.zip
- name: Add installer icon
if: contains(matrix.architecture, 'win-')
run: |
if ('${{ github.ref_name }}'.Contains('beta')) {
cp ./media/icon-beta.ico ./${{ env.release }}
} else {
cp ./media/icon.ico ./${{ env.release }}
}
- name: Update version in beta installer
if: contains(matrix.architecture, 'win-') && contains(github.ref_name, '-beta')
run: |
$content = Get-Content ./install-beta.iss
$content -replace '#define MyAppVersion .*', "#define MyAppVersion `"$("${{ github.ref_name }}".Substring(1))`"" | Set-Content ./install-beta.iss
- name: Set installer file name
id: installer
if: contains(matrix.architecture, 'win-')
run: |
if ('${{ github.ref_name }}'.Contains('beta')) {
Write-Output "filename=install-beta.iss" >> $env:GITHUB_OUTPUT
} else {
Write-Output "filename=install.iss" >> $env:GITHUB_OUTPUT
}
- name: Add install file
if: contains(matrix.architecture, 'win-')
run: cp ./${{ steps.installer.outputs.filename }} ./${{ env.release }}
- name: Build Installer
if: contains(matrix.architecture, 'win-')
run: ISCC.exe ${{ steps.installer.outputs.filename }} /F"dev-proxy-installer-${{ matrix.architecture }}-${{ github.ref_name }}"
working-directory: ./${{ env.release }}
- name: Upload Installer
if: contains(matrix.architecture, 'win-')
uses: actions/upload-artifact@v4
with:
name: installer-dev-proxy-${{ github.ref_name }}-${{ matrix.architecture }}
path: ./${{ env.release }}/dev-proxy-installer-${{ matrix.architecture }}-${{ github.ref_name }}.exe
- name: Installer SHA256 hash
if: contains(matrix.architecture, 'win-')
run: |
$(Get-FileHash ./${{ env.release }}/dev-proxy-installer-${{ matrix.architecture }}-${{ github.ref_name }}.exe -Algorithm SHA256).Hash
create_release:
name: Create Release
needs: [publish_binaries]
environment:
name: gh_releases
runs-on: [windows-latest]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: output
- name: Release
uses: anton-yurchenko/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "false"
PRE_RELEASE: "false"
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_EMPTY_CHANGELOG: "true"
with:
args: |
output/binaries-*/*.zip
output/installer-*/*.exe