|
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | version: |
7 | | - description: 'Version number (e.g., 1.0.0)' |
| 7 | + description: Version without leading v, for example 1.0.0 |
8 | 8 | required: true |
9 | | - default: '1.0.0' |
| 9 | + draft: |
| 10 | + description: Create release as draft |
| 11 | + type: boolean |
| 12 | + default: false |
| 13 | + prerelease: |
| 14 | + description: Mark release as prerelease |
| 15 | + type: boolean |
| 16 | + default: false |
10 | 17 |
|
11 | 18 | permissions: |
12 | 19 | contents: write |
13 | 20 |
|
14 | 21 | jobs: |
15 | | - build-and-upload: |
16 | | - name: Build for ${{ matrix.os }} |
| 22 | + build: |
| 23 | + name: Build ${{ matrix.name }} |
17 | 24 | runs-on: ${{ matrix.os }} |
18 | 25 | strategy: |
| 26 | + fail-fast: false |
19 | 27 | matrix: |
20 | 28 | include: |
21 | | - - os: windows-latest |
| 29 | + - name: windows-x86_64 |
| 30 | + os: windows-latest |
22 | 31 | target: x86_64-pc-windows-msvc |
23 | | - artifact_name: agent-switch.exe |
24 | | - asset_name: agent-switch-windows-x86_64.exe |
25 | | - - os: ubuntu-latest |
| 32 | + bin: agent-switch.exe |
| 33 | + asset: agent-switch-windows-x86_64.exe |
| 34 | + - name: linux-x86_64 |
| 35 | + os: ubuntu-latest |
26 | 36 | target: x86_64-unknown-linux-gnu |
27 | | - artifact_name: agent-switch |
28 | | - asset_name: agent-switch-linux-x86_64 |
29 | | - - os: macos-latest |
| 37 | + bin: agent-switch |
| 38 | + asset: agent-switch-linux-x86_64 |
| 39 | + - name: macos-x86_64 |
| 40 | + os: macos-13 |
| 41 | + target: x86_64-apple-darwin |
| 42 | + bin: agent-switch |
| 43 | + asset: agent-switch-macos-x86_64 |
| 44 | + - name: macos-aarch64 |
| 45 | + os: macos-latest |
30 | 46 | target: aarch64-apple-darwin |
31 | | - artifact_name: agent-switch |
32 | | - asset_name: agent-switch-macos-arm64 |
| 47 | + bin: agent-switch |
| 48 | + asset: agent-switch-macos-aarch64 |
33 | 49 |
|
34 | 50 | steps: |
35 | | - - name: Checkout code |
36 | | - uses: actions/checkout@v4 |
| 51 | + - uses: actions/checkout@v4 |
37 | 52 |
|
38 | | - - name: Install Rust |
39 | | - uses: dtolnay/rust-toolchain@stable |
| 53 | + - uses: dtolnay/rust-toolchain@stable |
40 | 54 | with: |
41 | 55 | targets: ${{ matrix.target }} |
42 | 56 |
|
43 | | - - name: Install Linux dependencies |
| 57 | + - name: Install Linux deps |
44 | 58 | if: runner.os == 'Linux' |
45 | | - run: sudo apt-get update; sudo apt-get install -y libxkbcommon-dev libvulkan-dev libwayland-dev xorg-dev |
| 59 | + 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 |
46 | 60 |
|
47 | | - - name: Build Release |
48 | | - run: cargo build --release --target ${{ matrix.target }} |
| 61 | + - name: Test |
| 62 | + run: cargo test --locked |
49 | 63 |
|
50 | | - - name: Rename Artifact |
| 64 | + - name: Build release |
| 65 | + run: cargo build --locked --release --target ${{ matrix.target }} |
| 66 | + |
| 67 | + - name: Stage asset |
51 | 68 | shell: bash |
52 | | - run: mv target/${{ matrix.target }}/release/${{ matrix.artifact_name }} ./${{ matrix.asset_name }} |
| 69 | + run: | |
| 70 | + mkdir -p dist |
| 71 | + cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "dist/${{ matrix.asset }}" |
| 72 | +
|
| 73 | + - uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: ${{ matrix.name }} |
| 76 | + path: dist/${{ matrix.asset }} |
| 77 | + if-no-files-found: error |
| 78 | + |
| 79 | + publish: |
| 80 | + name: Publish GitHub Release |
| 81 | + needs: build |
| 82 | + runs-on: ubuntu-latest |
| 83 | + steps: |
| 84 | + - uses: actions/download-artifact@v4 |
| 85 | + with: |
| 86 | + path: dist |
| 87 | + merge-multiple: true |
| 88 | + |
| 89 | + - name: Checksums |
| 90 | + run: cd dist && sha256sum * > SHA256SUMS.txt |
53 | 91 |
|
54 | | - - name: Upload to GitHub Release |
55 | | - uses: softprops/action-gh-release@v2 |
| 92 | + - uses: softprops/action-gh-release@v2 |
56 | 93 | with: |
57 | | - name: Release v${{ github.event.inputs.version }} |
58 | | - tag_name: v${{ github.event.inputs.version }} |
59 | | - files: ./${{ matrix.asset_name }} |
60 | | - env: |
61 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 94 | + tag_name: v${{ inputs.version }} |
| 95 | + name: AgentSwitch v${{ inputs.version }} |
| 96 | + draft: ${{ inputs.draft }} |
| 97 | + prerelease: ${{ inputs.prerelease }} |
| 98 | + files: dist/* |
0 commit comments