-
Notifications
You must be signed in to change notification settings - Fork 75
78 lines (69 loc) · 2.62 KB
/
Copy pathrelease-please.yml
File metadata and controls
78 lines (69 loc) · 2.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
name: Release Please
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
actions: write
jobs:
release:
runs-on: ubuntu-latest
if: "startsWith(github.event.head_commit.message, 'chore: release') || startsWith(github.event.head_commit.message, 'chore(main): release')"
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v5
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
skip-github-pull-request: true
- name: Trigger Release build workflow
if: ${{ steps.release.outputs.release_created == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Release created: ${{ steps.release.outputs.tag_name }}"
gh workflow run release.yml \
--repo "${{ github.repository }}" \
--field "tag_name=${{ steps.release.outputs.tag_name }}"
update-pr:
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, 'chore: release') && !startsWith(github.event.head_commit.message, 'chore(main): release')"
steps:
- uses: googleapis/release-please-action@v5
id: release-please
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
- name: Checkout release PR branch
if: steps.release-please.outputs.pr
uses: actions/checkout@v6
with:
ref: ${{ fromJSON(steps.release-please.outputs.pr).headBranchName }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain
if: steps.release-please.outputs.pr
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.95.0"
- name: Update Cargo.lock for workspace version bump
if: steps.release-please.outputs.pr
run: cargo update --workspace
- name: Commit and push Cargo.lock if changed
if: steps.release-please.outputs.pr
run: |
if git diff --quiet Cargo.lock; then
echo "Cargo.lock is already up to date"
else
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Cargo.lock
git commit -m "chore: update Cargo.lock for workspace version bump"
git push
fi