Skip to content

Commit 105268e

Browse files
committed
ci: add release-please and release artifacts workflows
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent 1e503bb commit 105268e

File tree

4 files changed

+175
-0
lines changed

4 files changed

+175
-0
lines changed

.github/release-please-config.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"changelog-sections": [
4+
{
5+
"type": "feat",
6+
"section": "Features",
7+
"hidden": false
8+
},
9+
{
10+
"type": "fix",
11+
"section": "Bug Fixes",
12+
"hidden": false
13+
}
14+
],
15+
"packages": {
16+
"rsworkspace/crates/acp-nats-stdio": {
17+
"component": "acp-nats-stdio"
18+
}
19+
},
20+
"plugins": [
21+
{
22+
"type": "sentence-case"
23+
},
24+
{
25+
"type": "cargo-workspace",
26+
"merge": false
27+
}
28+
],
29+
"tag-separator": "@",
30+
"include-v-in-tag": true,
31+
"include-component-in-tag": true,
32+
"release-type": "rust",
33+
"draft": false,
34+
"draft-pull-request": false,
35+
"prerelease": false,
36+
"pull-request-header": "An automated release has been created for you.",
37+
"separate-pull-requests": true,
38+
"signoff": "Straw Hat Team Bot <61149376+sht-bot@users.noreply.github.com>"
39+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"rsworkspace/crates/acp-nats-stdio": "0.0.1"
3+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: cd / release artifacts
2+
3+
on:
4+
push:
5+
tags:
6+
- "acp-nats-stdio@v*"
7+
8+
permissions:
9+
contents: write
10+
attestations: write
11+
id-token: write
12+
13+
env:
14+
CARGO_TERM_COLOR: always
15+
16+
jobs:
17+
build:
18+
name: Build (${{ matrix.target }})
19+
runs-on: ${{ matrix.runner }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- target: x86_64-unknown-linux-gnu
25+
runner: ubuntu-latest
26+
use-cross: false
27+
- target: aarch64-unknown-linux-gnu
28+
runner: ubuntu-latest
29+
use-cross: true
30+
- target: x86_64-apple-darwin
31+
runner: macos-13
32+
use-cross: false
33+
- target: aarch64-apple-darwin
34+
runner: macos-latest
35+
use-cross: false
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v6.0.2
40+
41+
- name: Extract version from tag
42+
id: version
43+
shell: bash
44+
run: echo "version=${GITHUB_REF_NAME#acp-nats-stdio@v}" >> "$GITHUB_OUTPUT"
45+
46+
- uses: jdx/mise-action@v4.0.1
47+
48+
- name: Add Rust target
49+
if: ${{ !matrix.use-cross }}
50+
run: rustup target add ${{ matrix.target }}
51+
52+
- name: Install cross
53+
if: ${{ matrix.use-cross }}
54+
uses: taiki-e/install-action@cross
55+
56+
- name: Cache dependencies
57+
uses: Swatinem/rust-cache@v2.9.1
58+
with:
59+
workspaces: rsworkspace -> target
60+
key: ${{ matrix.target }}
61+
62+
- name: Build
63+
working-directory: rsworkspace
64+
shell: bash
65+
run: |
66+
if [ "${{ matrix.use-cross }}" = "true" ]; then
67+
cross build --release --target ${{ matrix.target }} -p acp-nats-stdio
68+
else
69+
cargo build --release --target ${{ matrix.target }} -p acp-nats-stdio
70+
fi
71+
72+
- name: Package
73+
shell: bash
74+
run: |
75+
staging="acp-nats-stdio-${{ steps.version.outputs.version }}-${{ matrix.target }}"
76+
mkdir -p "$staging"
77+
cp "rsworkspace/target/${{ matrix.target }}/release/acp-nats-stdio" "$staging/"
78+
tar czf "$staging.tar.gz" "$staging"
79+
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
80+
81+
- name: Attest build provenance
82+
uses: actions/attest-build-provenance@v2
83+
with:
84+
subject-path: ${{ env.ASSET }}
85+
86+
- name: Upload artifact
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: ${{ matrix.target }}
90+
path: ${{ env.ASSET }}
91+
92+
upload:
93+
name: Upload to release
94+
needs: build
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: Checkout
98+
uses: actions/checkout@v6.0.2
99+
100+
- name: Download all artifacts
101+
uses: actions/download-artifact@v4
102+
with:
103+
path: artifacts
104+
merge-multiple: true
105+
106+
- name: Generate checksums
107+
working-directory: artifacts
108+
run: sha256sum acp-nats-stdio-* > sha256sums.txt
109+
110+
- name: Upload to GitHub Release
111+
env:
112+
GH_TOKEN: ${{ github.token }}
113+
run: gh release upload "$GITHUB_REF_NAME" artifacts/* --clobber
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: cd / release please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@v4
17+
with:
18+
token: ${{ secrets.GH_PAT_RELEASE_PLEASE_ACTION }}
19+
config-file: .github/release-please-config.json
20+
manifest-file: .github/release-please-manifest.json

0 commit comments

Comments
 (0)