-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (83 loc) · 2.57 KB
/
release.yml
File metadata and controls
96 lines (83 loc) · 2.57 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: Version without leading v, for example 1.0.0
required: true
draft:
description: Create release as draft
type: boolean
default: false
prerelease:
description: Mark release as prerelease
type: boolean
default: false
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
bin: agent-switch.exe
asset: agent-switch-windows-x86_64.exe
- name: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: agent-switch
asset: agent-switch-linux-x86_64
- name: macos-x86_64
os: macos-latest
target: x86_64-apple-darwin
bin: agent-switch
asset: agent-switch-macos-x86_64
- name: macos-aarch64
os: macos-latest
target: aarch64-apple-darwin
bin: agent-switch
asset: agent-switch-macos-aarch64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux deps
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y pkg-config libgtk-3-dev libx11-dev libxi-dev libxkbcommon-dev libwayland-dev libgl1-mesa-dev libasound2-dev
- name: Test
run: cargo test --locked
- name: Build release
run: cargo build --locked --release --target ${{ matrix.target }}
- name: Stage asset
shell: bash
run: |
mkdir -p dist
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "dist/${{ matrix.asset }}"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: dist/${{ matrix.asset }}
if-no-files-found: error
publish:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
name: AgentSwitch v${{ inputs.version }}
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
files: dist/*