-
-
Notifications
You must be signed in to change notification settings - Fork 32
162 lines (140 loc) · 5.39 KB
/
dotnet-build.yml
File metadata and controls
162 lines (140 loc) · 5.39 KB
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
name: Build
on:
push:
branches: [ "main" ]
tags: [ "v*" ]
pull_request:
branches: [ "main" ]
jobs:
build:
permissions:
contents: read
strategy:
matrix:
os: [windows-2022, windows-11-arm]
runs-on: ${{ matrix.os }}
env:
arch: ${{ matrix.os == 'windows-2022' && 'x64' || (matrix.os == 'windows-11-arm' && 'arm64' || 'unknown') }}
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5
with:
dotnet-version: 8.0.x
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Tests
run: task test
- name: Build SyncTrayzor (Portable)
run: task build-portable
- name: Upload portable dist
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
with:
name: SyncTrayzorPortable-${{ env.arch }}.zip
path: ./release/SyncTrayzorPortable-${{ env.arch }}.zip
- name: Build SyncTrayzor Installer
run: task build-installer
- name: Upload installer dist
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
with:
name: SyncTrayzorSetup-${{ env.arch }}.exe
path: ./release/SyncTrayzorSetup-${{ env.arch }}.exe
release:
if: github.ref_type == 'tag'
needs: build
runs-on: windows-2022
permissions:
contents: write
discussions: write
steps:
- name: Checkout repo
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
fetch-depth: 0
- name: Download all build artifacts
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
with:
path: "${{ github.workspace }}/release"
merge-multiple: true
- name: Install .NET Core
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5
with:
dotnet-version: 8.0.x
- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Write private key to file
run: |
cat << EOF > synctrayzor_private_key.asc
${{ secrets.SYNCTRAYZOR_PRIVATE_KEY }}
EOF
shell: bash
- name: Sign artifacts
run: task sign-release
env:
SYNCTRAYZOR_PRIVATE_KEY: "${{ github.workspace }}\\synctrayzor_private_key.asc"
SYNCTRAYZOR_PRIVATE_KEY_PASSPHRASE: "${{ secrets.SYNCTRAYZOR_PRIVATE_KEY_PASSPHRASE }}"
- name: Upload signature file
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
with:
name: sha512sum.txt.asc
path: release/sha512sum.txt.asc
- name: Get version from tag
id: tag_name
run: |
echo "current_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
shell: bash
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@32aa5b4c155d76c94e4ec883a223c947b2f02656 # v2
with:
validation_level: warn
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- name: Create GitHub Release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
with:
files: |
release/**
name: Release ${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
discussion_category_name: "Releases"
preserve_order: true
fail_on_unmatched_files: true
append_body: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Chocolatey Extensions
run: choco install chocolatey-community-validation.extension -y
shell: powershell
- name: Build Chocolatey Package
run: task build-choco-package
env:
SYNCTRAYZOR_VERSION: ${{ steps.changelog_reader.outputs.version }}
SYNCTRAYZOR_RELEASE_NOTES: ${{ steps.changelog_reader.outputs.changes }}
- name: Upload choco package
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
with:
path: ./release/synctrayzor*.nupkg
- name: Push Chocolatey Package
if: steps.changelog_reader.outputs.status != 'prereleased' && steps.changelog_reader.outputs.status != 'unreleased'
run: |
$packagePath = Get-ChildItem "${{ github.workspace }}/release" -Filter "synctrayzor*.nupkg" | Select-Object -ExpandProperty FullName
choco apikey --key ${{ secrets.CHOCO_API_KEY }} --source https://push.chocolatey.org/
choco push $packagePath --source https://push.chocolatey.org/
shell: powershell
- name: Publish to winget
uses: vedantmgoyal9/winget-releaser@main
with:
identifier: GermanCoding.SyncTrayzor
installers-regex: '-x64\.exe$'
max-versions-to-keep: 5 # keep only latest 5 versions
token: ${{ secrets.WINGET_TOKEN }}