-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (96 loc) · 2.84 KB
/
build-and-pack.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
name: Build and Package
on:
push:
branches: [main]
paths-ignore:
- "**.md"
- "LICENSE"
env:
APP_VERSION: "0.2.${{ github.run_number }}"
jobs:
build:
runs-on: windows-latest
steps:
- name: debug
run: "echo app version: $APP_VERSION"
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: dotnet publish
run: dotnet publish -o pub -c release -p:PublishSingleFile=true -p:Version=${{ env.APP_VERSION }}
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries
path: pub
choco-pack:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: binaries
path: bin
- name: Package
run: cd choco && choco pack --version ${{ env.APP_VERSION }}
- name: Upload nupkg
uses: actions/upload-artifact@v4
with:
name: nupkg
path: choco/*.nupkg
publish-choco:
if: github.ref == 'refs/heads/main'
needs: choco-pack
runs-on: windows-latest
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: nupkg
- name: publish to chocolatey community feed
env:
PUSH_URL: ${{ secrets.PUSH_URL }}
API_KEY: ${{ secrets.API_KEY }}
run: |
$nupkgs = Get-ChildItem . *.nupkg
foreach ($pkg in $nupkgs) {
Write-Host "Pushing: $($pkg.FullName) ..."
choco push "$($pkg.FullName)" -s "$env:PUSH_URL" -k "$env:API_KEY"
}
create-release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: binaries
path: bin
- name: Easy Zip Files
uses: vimtor/action-zip@v1
with:
dest: "Filesorter_${{ env.APP_VERSION }}.zip"
files: bin/
- name: Publish GitHub release
uses: ncipollo/release-action@v1
with:
artifacts: "Filesorter_${{ env.APP_VERSION }}.zip"
artifactContentType: "application/zip"
tag: ${{ env.APP_VERSION }}
prerelease: ${{ github.ref != 'refs/heads/main'}}
token: ${{ secrets.GITHUB_TOKEN }}
publish-winget:
needs: create-release
runs-on: ubuntu-latest
steps:
- name: Update Packages
uses: michidk/winget-updater@v1
with:
komac-token: ${{ secrets.GITHUB_TOKEN }}
identifier: BC3Tech.FileSorter
repo: bc3tech/filesorter
url: https://github.com/bc3tech/filesorter/releases/download/{VERSION}/FileSorter_{VERSION}.zip