-
Notifications
You must be signed in to change notification settings - Fork 3
125 lines (109 loc) · 3.62 KB
/
Copy pathrelease-artifacts.yml
File metadata and controls
125 lines (109 loc) · 3.62 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: cd / release artifacts
on:
push:
tags:
- "acp-nats-stdio@v*"
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
permissions:
contents: read
attestations: write
id-token: write
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
use-cross: false
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
use-cross: true
- target: x86_64-apple-darwin
runner: macos-15-intel
use-cross: false
- target: aarch64-apple-darwin
runner: macos-latest
use-cross: false
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Extract version from tag
id: version
shell: bash
run: echo "version=${GITHUB_REF_NAME#acp-nats-stdio@v}" >> "$GITHUB_OUTPUT"
- uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0
with:
cache: false
- name: Add Rust target
if: ${{ !matrix.use-cross }}
run: rustup target add ${{ matrix.target }}
- name: Install cross
if: ${{ matrix.use-cross }}
uses: taiki-e/install-action@16b05812d776ae1dfaabc8277e421fb6d2506419 # v2.82.7
with:
tool: cross
- name: Build
working-directory: rsworkspace
shell: bash
env:
USE_CROSS: ${{ matrix.use-cross }}
TARGET: ${{ matrix.target }}
run: |
if [ "$USE_CROSS" = "true" ]; then
cross build --release --target "$TARGET" -p acp-nats-stdio
else
cargo build --release --target "$TARGET" -p acp-nats-stdio
fi
- name: Package
shell: bash
env:
VERSION: ${{ steps.version.outputs.version }}
TARGET: ${{ matrix.target }}
run: |
staging="acp-nats-stdio-${VERSION}-${TARGET}"
mkdir -p "$staging"
cp "rsworkspace/target/${TARGET}/release/acp-nats-stdio" "$staging/"
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
- name: Attest build provenance
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
with:
subject-path: ${{ env.ASSET }}
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.target }}
path: ${{ env.ASSET }}
upload:
name: Upload to release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
working-directory: artifacts
run: sha256sum acp-nats-stdio-* > sha256sums.txt
- name: Upload to GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "$GITHUB_REF_NAME" || \
gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes
gh release upload "$GITHUB_REF_NAME" artifacts/* --clobber