Skip to content

Commit 080ad04

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

File tree

6 files changed

+219
-1
lines changed

6 files changed

+219
-1
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+
}

.github/workflows/pr-title.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: PR Title Lint
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
lint-pr-title:
15+
name: Validate PR Title
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
types: |
23+
fix
24+
chore
25+
feat
26+
refactor
27+
ci
28+
requireScope: false
29+
disallowScopes: ""
30+
subjectPattern: ^(?![A-Z]).+$
31+
subjectPatternError: |
32+
The subject "{subject}" found in the pull request title "{title}"
33+
should start with a lowercase letter.
34+
ignoreLabels: |
35+
bot
36+
dependencies
37+
autorelease: pending
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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-15-intel
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+
env:
66+
USE_CROSS: ${{ matrix.use-cross }}
67+
TARGET: ${{ matrix.target }}
68+
run: |
69+
if [ "$USE_CROSS" = "true" ]; then
70+
cross build --release --target "$TARGET" -p acp-nats-stdio
71+
else
72+
cargo build --release --target "$TARGET" -p acp-nats-stdio
73+
fi
74+
75+
- name: Package
76+
shell: bash
77+
env:
78+
VERSION: ${{ steps.version.outputs.version }}
79+
TARGET: ${{ matrix.target }}
80+
run: |
81+
staging="acp-nats-stdio-${VERSION}-${TARGET}"
82+
mkdir -p "$staging"
83+
cp "rsworkspace/target/${TARGET}/release/acp-nats-stdio" "$staging/"
84+
tar czf "$staging.tar.gz" "$staging"
85+
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
86+
87+
- name: Attest build provenance
88+
uses: actions/attest-build-provenance@v2
89+
with:
90+
subject-path: ${{ env.ASSET }}
91+
92+
- name: Upload artifact
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: ${{ matrix.target }}
96+
path: ${{ env.ASSET }}
97+
98+
upload:
99+
name: Upload to release
100+
needs: build
101+
runs-on: ubuntu-latest
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v6.0.2
105+
106+
- name: Download all artifacts
107+
uses: actions/download-artifact@v4
108+
with:
109+
path: artifacts
110+
merge-multiple: true
111+
112+
- name: Generate checksums
113+
working-directory: artifacts
114+
run: sha256sum acp-nats-stdio-* > sha256sums.txt
115+
116+
- name: Upload to GitHub Release
117+
env:
118+
GH_TOKEN: ${{ github.token }}
119+
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

rsworkspace/crates/acp-nats-stdio/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "acp-nats-stdio"
3-
version = "0.1.0"
3+
version = "0.0.1"
44
edition = "2024"
55

66
[lints]

0 commit comments

Comments
 (0)