-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (134 loc) · 5.12 KB
/
release.yml
File metadata and controls
146 lines (134 loc) · 5.12 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create.outputs.id }}
upload_url: ${{ steps.create.outputs.upload_url }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Create release
id: create
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
with:
draft: true
generate_release_notes: true
build-tauri:
name: Build Tauri (${{ matrix.platform }})
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
target: aarch64-apple-darwin
- platform: macos-latest
target: x86_64-apple-darwin
- platform: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- platform: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 # stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
cache: npm
- run: npm ci
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Build Tauri app
uses: tauri-apps/tauri-action@42a8e7afed21ef2e1b5d4e3bdd3b7e075e1f52d2 # v0.5.18
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
args: --target ${{ matrix.target }}
build-cli:
name: Build CLI (${{ matrix.target }})
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
binary: shepherd
- os: macos-latest
target: x86_64-apple-darwin
binary: shepherd
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
binary: shepherd
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: shepherd.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 # stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cli-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cli-${{ matrix.target }}-
- name: Build CLI binaries
run: |
cargo build --release --target ${{ matrix.target }} --package shepherd-cli
cargo build --release --target ${{ matrix.target }} --package shepherd-server
- name: Package CLI (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/shepherd dist/
cp target/${{ matrix.target }}/release/shep dist/
cp target/${{ matrix.target }}/release/shepherd-server dist/
cd dist && tar czf shepherd-cli-${{ matrix.target }}.tar.gz shepherd shep shepherd-server
shasum -a 256 shepherd-cli-${{ matrix.target }}.tar.gz > shepherd-cli-${{ matrix.target }}.tar.gz.sha256
- name: Package CLI (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist
Copy-Item target/${{ matrix.target }}/release/shepherd.exe dist/
Copy-Item target/${{ matrix.target }}/release/shep.exe dist/
Copy-Item target/${{ matrix.target }}/release/shepherd-server.exe dist/
Compress-Archive -Path dist/shepherd.exe,dist/shep.exe,dist/shepherd-server.exe -DestinationPath dist/shepherd-cli-${{ matrix.target }}.zip
Get-FileHash dist/shepherd-cli-${{ matrix.target }}.zip -Algorithm SHA256 | Format-List Hash > dist/shepherd-cli-${{ matrix.target }}.zip.sha256
- name: Upload CLI artifacts
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
with:
files: |
dist/shepherd-cli-*
publish-release:
name: Publish release
needs: [build-tauri, build-cli]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Publish release (remove draft)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release edit ${{ github.ref_name }} --draft=false