-
Notifications
You must be signed in to change notification settings - Fork 1
125 lines (104 loc) · 3.3 KB
/
release.yml
File metadata and controls
125 lines (104 loc) · 3.3 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.85.0
with:
profile: minimal
- name: Build (release)
run: cargo build --release --locked
- name: Package Windows zip
shell: pwsh
run: |
$version = "${{ github.ref_name }}"
New-Item -ItemType Directory -Force -Path staging
Copy-Item target/release/recur.exe staging/
Copy-Item target/release/recur-git.exe staging/
Copy-Item README.md staging/
Compress-Archive -Path staging/* -DestinationPath "recur-${version}-x86_64-pc-windows-msvc.zip"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-zip
path: recur-*.zip
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.85.0
with:
profile: minimal
- name: Build (release)
run: cargo build --release --locked
- name: Package Linux tarball
run: |
VERSION="${{ github.ref_name }}"
mkdir staging
cp target/release/recur staging/
cp target/release/recur-git staging/
cp README.md staging/
tar czf "recur-${VERSION}-x86_64-unknown-linux-gnu.tar.gz" -C staging .
- name: Build .deb package
run: |
cargo install cargo-deb
cargo deb --no-build
- name: Upload tarball
uses: actions/upload-artifact@v4
with:
name: linux-tarball
path: recur-*.tar.gz
- name: Upload deb
uses: actions/upload-artifact@v4
with:
name: linux-deb
path: target/debian/*.deb
release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/windows-zip/*.zip
artifacts/linux-tarball/*.tar.gz
artifacts/linux-deb/*.deb
chocolatey:
needs: [release]
runs-on: windows-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Download Windows zip
uses: actions/download-artifact@v4
with:
name: windows-zip
path: artifacts
- name: Pack Chocolatey package
shell: pwsh
run: |
$version = "${{ github.ref_name }}".TrimStart('v')
$zip = Get-ChildItem artifacts/*.zip | Select-Object -First 1
./scripts/pack_choco_release.ps1 -Version $version -ZipPath $zip.FullName -OutputDirectory choco
- name: Push to Chocolatey
shell: pwsh
run: |
$nupkg = Get-ChildItem choco/*.nupkg | Select-Object -First 1
Write-Host "Pushing $($nupkg.FullName)"
choco push $nupkg.FullName --source https://push.chocolatey.org/ --api-key ${{ secrets.CHOCOLATEY_API_KEY }}