Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 4474b3a

Browse files
committed
ci(release): add release-please
1 parent 86c4454 commit 4474b3a

File tree

4 files changed

+98
-1
lines changed

4 files changed

+98
-1
lines changed

.github/workflows/hello-rust-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
uses: clechasseur/rs-cargo@v2
2323
with:
2424
command: build
25-
args: --verbose --manifest-path hello-rust/Cargo.toml
25+
args: --verbose --release --manifest-path hello-rust/Cargo.toml
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 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+
outputs:
16+
hello-react--tag_name: ${{ steps.release.outputs.hello-react--tag_name}}
17+
hello-react--release_created: ${{ steps.release.outputs.hello-react--release_created}}
18+
hello-rust--tag_name: ${{ steps.release.outputs.hello-rust--tag_name}}
19+
hello-rust--release_created: ${{ steps.release.outputs.hello-rust--release_created}}
20+
steps:
21+
- uses: googleapis/release-please-action@v4
22+
id: release
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
config-file: release-please-config.json
26+
manifest-file: .release-please-manifest.json
27+
- name: Print release outputs for debugging
28+
continue-on-error: true
29+
run: |
30+
echo "Release outputs:"
31+
echo "${{ toJson(steps.release.outputs) }}"
32+
33+
34+
release-hello-react:
35+
if: ${{needs.release-please.outputs.hello-react--release_created}}
36+
runs-on: ubuntu-latest
37+
needs: release-please
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: actions/setup-node@v4
41+
with:
42+
node-version: 18
43+
- uses: actions/cache@v3
44+
with:
45+
path: hello-react/node_modules
46+
key: "${{ runner.os }}-node-${{ hashFiles('hello-react/package-lock.json') }}"
47+
- run: npm ci --prefix hello-react
48+
- run: npm test --prefix hello-react -- a --watchAll=false
49+
- run: npm run build --prefix hello-react
50+
- run: zip -r hello-react-build.zip hello-react/build
51+
- name: Upload Release Artifact
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
run: gh release upload ${{ needs.release-please.outputs.hello-react--tag_name }} hello-react-build.zip
55+
56+
release-hello-rust:
57+
if: ${{needs.release-please.outputs.hello-rust--release_created}}
58+
runs-on: ubuntu-latest
59+
needs: release-please
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: dtolnay/rust-toolchain@stable
63+
- name: Test
64+
uses: clechasseur/rs-cargo@v2
65+
with:
66+
command: test
67+
args: --verbose --manifest-path hello-rust/Cargo.toml
68+
- name: Build
69+
uses: clechasseur/rs-cargo@v2
70+
with:
71+
command: build
72+
args: --verbose --release --manifest-path hello-rust/Cargo.toml --target x86_64-unknown-linux-gnu
73+
- name: Upload Release Artifact
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
run: gh release upload ${{ needs.release-please.outputs.hello-rust--tag_name }} hello-rust/target/x86_64-unknown-linux-gnu/release/hello_rust

.release-please-manifest.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"hello-react": "0.1.0",
3+
"hello-rust": "0.1.0"
4+
}

release-please-config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"include-component-in-tag": true,
3+
"include-v-in-tag": true,
4+
"tag-separator": "@",
5+
"separate-pull-requests": true,
6+
"packages": {
7+
"hello-react": {
8+
"path": "hello-react",
9+
"release-type": "node"
10+
},
11+
"hello-rust": {
12+
"path": "hello-rust",
13+
"release-type": "rust"
14+
}
15+
},
16+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
17+
}

0 commit comments

Comments
 (0)