-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (114 loc) · 4.01 KB
/
Copy pathrelease.yml
File metadata and controls
133 lines (114 loc) · 4.01 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
name: Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
build:
name: Build (${{ matrix.asset_target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rust_target: x86_64-unknown-linux-gnu
asset_target: linux-amd64
platform: linux
- os: ubuntu-latest
rust_target: aarch64-unknown-linux-gnu
asset_target: linux-arm64
platform: linux
- os: macos-latest
rust_target: x86_64-apple-darwin
asset_target: macos-amd64
platform: macos
- os: macos-latest
rust_target: aarch64-apple-darwin
asset_target: macos-arm64
platform: macos
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
asset_target: windows-amd64
platform: windows
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- uses: Swatinem/rust-cache@v2
- name: Install Linux ARM64 linker
if: matrix.rust_target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
- name: Compute version and artifact name
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "ASSET_BASENAME=agentwise-${VERSION}-${{ matrix.asset_target }}" >> "$GITHUB_ENV"
- name: Build
run: cargo build --release --target ${{ matrix.rust_target }}
- name: Package (Unix)
if: matrix.platform != 'windows'
shell: bash
run: |
mkdir -p dist package
cp "target/${{ matrix.rust_target }}/release/agentwise" "package/agentwise"
tar -czf "dist/${ASSET_BASENAME}.tar.gz" -C package agentwise
echo "ASSET_PATH=dist/${ASSET_BASENAME}.tar.gz" >> "$GITHUB_ENV"
- name: Package (Windows)
if: matrix.platform == 'windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Path dist, package -Force | Out-Null
Copy-Item "target/${{ matrix.rust_target }}/release/agentwise.exe" "package/agentwise.exe"
Compress-Archive -Path "package/agentwise.exe" -DestinationPath "dist/$env:ASSET_BASENAME.zip" -Force
"ASSET_PATH=dist/$env:ASSET_BASENAME.zip" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET_BASENAME }}
path: ${{ env.ASSET_PATH }}
release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Compute version
shell: bash
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Generate SHA256 checksums
shell: bash
run: |
cd dist
sha256sum agentwise-* > "agentwise-${VERSION}-checksums.txt"
- name: Upload checksums artifact
uses: actions/upload-artifact@v4
with:
name: agentwise-${{ env.VERSION }}-checksums
path: dist/agentwise-${{ env.VERSION }}-checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: agentwise ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
dist/agentwise-*.tar.gz
dist/agentwise-*.zip
dist/agentwise-${{ env.VERSION }}-checksums.txt