-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (103 loc) · 3.35 KB
/
shared-release-please.yaml
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
# This file is @generated by <https://github.com/liblaf/copier-release>.
# DO NOT EDIT!
name: (Shared) Release Please
on:
push:
branches:
- main
workflow_dispatch:
jobs:
release-please:
name: Release Please
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-release-please
cancel-in-progress: true
outputs:
created: ${{ steps.release-please.outputs.release_created }}
pr: ${{ steps.release-please.outputs.pr }}
tag: ${{ steps.release-please.outputs.tag_name }}
steps:
- id: release-please
name: Release Please
uses: googleapis/release-please-action@v4
with:
config-file: .github/release-please/config.json
manifest-file: .github/release-please/.manifest.json
token: ${{ github.token }}
changelog-pr:
name: Changelog (PR)
permissions:
contents: write
needs:
- release-please
if: ${{ needs.release-please.outputs.pr }}
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-changelog-pr
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
token: ${{ github.token }}
fetch-depth: 0
- id: tag
name: Parse Tag
run: |-
title="${{ fromJson(needs.release-please.outputs.pr).title }}"
version=$(echo "$title" | awk '{ print $NF }')
echo "tag=v$version" >> "$GITHUB_OUTPUT"
- name: Changelog
uses: liblaf/actions/changelog@main
with:
args: --tag "${{ steps.tag.outputs.tag }}"
output: CHANGELOG.md
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(docs): update CHANGELOG.md"
file_pattern: CHANGELOG.md
changelog-release:
name: Changelog (Release)
permissions:
actions: write
contents: write
needs:
- release-please
if: ${{ needs.release-please.outputs.created }}
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-changelog-release
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.release-please.outputs.tag }}
fetch-depth: 0
- id: changelog
name: Changelog
uses: liblaf/actions/changelog@main
with:
args: --current --strip all
- name: Update Release
run: gh release edit "${{ needs.release-please.outputs.tag }}" --notes-file "${{ steps.changelog.outputs.changelog }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Trigger Release Workflow
run: |-
WORKFLOW_FILES=(.github/workflows/{,shared-}release{.yaml,.yml})
for workflow_file in "${WORKFLOW_FILES[@]}"; do
if [[ -f $workflow_file ]]; then
workflow_name=$(basename -- "$workflow_file")
echo "::notice::Triggering workflow: $workflow_name"
gh workflow run "$workflow_name" --ref "${{ needs.release-please.outputs.tag }}"
fi
done
env:
GH_TOKEN: ${{ github.token }}