-
Notifications
You must be signed in to change notification settings - Fork 27
107 lines (85 loc) · 7.37 KB
/
publish.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
name: Publish
on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish'
required: true
permissions:
contents: write
jobs:
create-draft-release:
name: Create Draft Release
runs-on: ubuntu-latest
steps:
- uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: true
generate_release_notes: true
name: ${{ github.event.inputs.version }}
tag_name: ${{ github.event.inputs.version }}
build-windows:
name: Build (${{ matrix.rid }})
runs-on: windows-latest
environment: release
needs: [create-draft-release]
strategy:
matrix:
rid: [win-x64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- id: import-cert
name: Import Code Signing Certificate
shell: pwsh
run: |
$data = [System.Convert]::FromBase64String($env:CertificateContents)
$path = [System.IO.Path]::Combine($env:RUNNER_TEMP, 'certificate.pfx')
Set-Content -Path $path -Value $data -AsByteStream
echo "certPath=$path" >> $env:GITHUB_OUTPUT
env:
CertificateContents: ${{ secrets.CODESIGN_CERTIFICATE }}
- id: deploytool
name: Download Deployment Tool
shell: pwsh
run: |
$zipPath = [System.IO.Path]::Combine($env:TEMP, 'onionfruit-deploy.zip')
$deployToolHome = [System.IO.Path]::Combine($env:TEMP, 'onionfruit-deploy')
Invoke-WebRequest -Uri https://github.com/dragonfruitnetwork/onionfruit-deploy/releases/latest/download/onionfruit-deploy.zip -OutFile $zipPath
Expand-Archive -Path $zipPath -DestinationPath $deployToolHome
Copy-Item -Path oniondeploy.xml -Destination $deployToolHome
echo "home=$deployToolHome" >> $env:GITHUB_OUTPUT
- name: Restore .NET Tools
run: dotnet tool restore
- name: Restore NuGet Packages
run: dotnet restore
- name: Update nuget-licenses.json
run: dotnet tool run nuget-license -o JsonPretty -ji DragonFruit.OnionFruit.Windows/nuget-license-sources.json | Out-File -FilePath DragonFruit.OnionFruit/Assets/nuget-licenses.json -Encoding utf8
continue-on-error: true
- name: Run deployment tool
working-directory: ${{ steps.deploytool.outputs.home }}
run: dotnet DragonFruit.OnionFruit.Deploy.dll ${{ github.workspace }}\DragonFruit.OnionFruit.Windows\DragonFruit.OnionFruit.Windows.csproj ${{ matrix.rid }} "${{ github.event.inputs.version }}"
env:
ONIONDEPLOY_GitHub__Token: ${{ github.token }}
ONIONDEPLOY_CodeSign__Password: ${{ secrets.CODESIGN_PASSWORD }}
ONIONDEPLOY_CodeSign__Certificate: ${{ steps.import-cert.outputs.certPath }}
copy-legacy:
name: Copy legacy updater files
runs-on: ubuntu-latest
needs: [build-windows]
steps:
- name: Download release assets
run: |
curl -s -H "Authorization: token ${{ github.token }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/dragonfruitnetwork/onionfruit/releases/latest \
| jq -r '.assets[] | select(.name | endswith(".nupkg") or . == "RELEASES") | .browser_download_url' \
| xargs -n 1 curl -L -O -J
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.version }}
files: |
*.nupkg
RELEASES