-
Notifications
You must be signed in to change notification settings - Fork 2
125 lines (109 loc) · 5.37 KB
/
ManualReleaseDevelop.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
name: "Manual Release - Develop"
on: workflow_dispatch
jobs:
publish:
name: "Publish"
runs-on: "windows-latest"
strategy:
matrix:
publish-profile-name: [x86, x64]
env:
working-directory: .
project-name: SRTHost
platform: ${{matrix.publish-profile-name}}
outputs:
solution: ${{steps.generated-variables-1.outputs.solution}}
project: ${{steps.generated-variables-1.outputs.project}}
publish-directory: ${{steps.generated-variables-1.outputs.publish-directory}}
zip-filename: ${{steps.generated-variables-2.outputs.zip-filename}}
version: ${{steps.get_version.outputs.RELEASE_VERSION}}
steps:
# Checkout latest code
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: develop
# Set some output variables
- name: Set the main environment variables based on other environment variables
id: generated-variables-1
run: |
echo '::set-output name=solution::${{env.project-name}}.sln'
echo '::set-output name=project::${{env.project-name}}/${{env.project-name}}.csproj'
echo '::set-output name=publish-directory::${{env.project-name}}/bin/Release/net5.0-windows/publish/'
# Get the project's version number
- name: Get project version
id: get_version
uses: greenygh0st/net-proj-release-version@v1
with:
PROJ_FILE: ${{steps.generated-variables-1.outputs.project}}
# Sets the zip-filename output variable based on the project version
- name: Sets the zip-filename environment variable based on the project version
id: generated-variables-2
run: |
echo '::set-output name=zip-filename::${{env.project-name}}-v${{steps.get_version.outputs.RELEASE_VERSION}}.zip'
# Install .NET
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
# Compiles the program and runs the publish profile
- name: Compile and run publish profile
run: |
dotnet publish ${{steps.generated-variables-1.outputs.solution}} /p:PublishProfile=${{matrix.publish-profile-name}}
# Decode the base 64 encoded pfx and save the code signing certificate
- name: Decode the pfx
run: |
Set-Content -Path '${{steps.generated-variables-1.outputs.publish-directory}}/CodeSign.txt' -Value '${{ secrets.CERTIFICATE }}'
certutil -decode '${{steps.generated-variables-1.outputs.publish-directory}}/CodeSign.txt' '${{steps.generated-variables-1.outputs.publish-directory}}/CodeSign.pfx'
Remove-Item -Path '${{steps.generated-variables-1.outputs.publish-directory}}/CodeSign.txt'
- name: Code sign the exes
run: |
$filesToZip = (Get-ChildItem -Path '${{steps.generated-variables-1.outputs.publish-directory}}' -Filter SRTHost*.exe).fullname
foreach ($fileToZip in $filesToZip) {
& "C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/signtool.exe" sign /tr "http://timestamp.digicert.com" /td SHA1 /f "${{steps.generated-variables-1.outputs.publish-directory}}/CodeSign.pfx" /p "${{secrets.CERTIFICATE_PASS}}" /fd SHA1 "$fileToZip"
& "C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/signtool.exe" sign /tr "http://timestamp.digicert.com" /td SHA1 /f "${{steps.generated-variables-1.outputs.publish-directory}}/CodeSign.pfx" /p "${{secrets.CERTIFICATE_PASS}}" /fd SHA256 /as "$fileToZip"
& "C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/signtool.exe" sign /tr "http://timestamp.digicert.com" /td SHA1 /f "${{steps.generated-variables-1.outputs.publish-directory}}/CodeSign.pfx" /p "${{secrets.CERTIFICATE_PASS}}" /fd SHA512 /as "$fileToZip"
}
- name: Upload publish artifacts
uses: actions/upload-artifact@v2
with:
path: |
${{steps.generated-variables-1.outputs.publish-directory}}SRTHost*.exe
release:
name: "Release"
runs-on: "windows-latest"
needs: publish
env:
working-directory: .
is-prerelease: true
steps:
# Checkout latest code
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v2
# Zip the publish artifacts
- name: Zip the publish artifacts
run: |
Add-Type -assembly 'System.IO.Compression'
Add-Type -assembly 'System.IO.Compression.FileSystem'
[System.IO.Compression.ZipArchive]$zipFile = [System.IO.Compression.ZipFile]::Open('${{needs.publish.outputs.zip-filename}}', ([System.IO.Compression.ZipArchiveMode]::Create))
$filesToZip = (Get-ChildItem -Path artifact/ -Filter SRTHost*.exe).fullname
foreach ($fileToZip in $filesToZip) {
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, $fileToZip, (Split-Path $fileToZip -Leaf))
}
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, 'LICENSE', 'LICENSE')
$zipFile.Dispose()
# Pushes the release
- name: Publish release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "develop-build"
prerelease: ${{env.is-prerelease}}
title: 'Manual Build [develop] - ${{needs.publish.outputs.version}} Release'
files: |
${{needs.publish.outputs.zip-filename}}