-
-
Notifications
You must be signed in to change notification settings - Fork 77
114 lines (103 loc) · 4.19 KB
/
Copy pathrelease-please.yml
File metadata and controls
114 lines (103 loc) · 4.19 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
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
109
110
111
112
113
114
name: Create Release
on:
push:
branches:
- develop
workflow_dispatch:
inputs:
release-mode:
description: 'auto = follow conventional commits; rc = bump the rc suffix; stable = open a PR that graduates the current rc to a stable release.'
type: choice
required: false
default: auto
options:
- auto
- rc
- stable
jobs:
release-please:
if: github.event_name != 'workflow_dispatch' || inputs.release-mode != 'stable'
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v5
with:
token: ${{ secrets.GRAYCORE_GITHUB_TOKEN }}
config-file: ${{ inputs.release-mode == 'rc' && 'release-please-config.rc.json' || 'release-please-config.json' }}
target-branch: develop
- uses: actions/checkout@v6
with:
ref: release-please--branches--develop--components--daffodil
token: ${{ secrets.GRAYCORE_GITHUB_TOKEN }}
- name: Add Packages to README
uses: graycoreio/daffodil/.github/actions/add-packages-to-readme@develop
- name: Annotate deprecation messages
uses: graycoreio/daffodil/.github/actions/deprecations@develop
with:
mode: annotate
- name: Commit and push
run: |
git config user.name "GrayBot"
git config user.email "automation@graycore.io"
git add README.md
git commit -m 'docs: autogenerate package table in README' || true
git add .
git commit -m 'docs: annotate deprecation messages' || true
git push
graduate:
if: github.event_name == 'workflow_dispatch' && inputs.release-mode == 'stable'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.repository.default_branch }}
token: ${{ secrets.GRAYCORE_GITHUB_TOKEN }}
- name: Compute graduate version
id: graduate
run: |
CURRENT=$(jq -r '."."' .release-please-manifest.json)
STABLE="${CURRENT%%-*}"
if [ "$CURRENT" = "$STABLE" ]; then
echo "::error::Manifest version ${CURRENT} has no prerelease suffix; nothing to graduate."
exit 1
fi
echo "CURRENT=${CURRENT}" >> $GITHUB_OUTPUT
echo "STABLE=${STABLE}" >> $GITHUB_OUTPUT
- name: Open graduate PR
env:
GRAYBOT_GPG_KEY: ${{ secrets.GRAYBOT_GPG_KEY }}
GH_TOKEN: ${{ secrets.GRAYCORE_GITHUB_TOKEN }}
CURRENT: ${{ steps.graduate.outputs.CURRENT }}
STABLE: ${{ steps.graduate.outputs.STABLE }}
run: |
echo "$GRAYBOT_GPG_KEY" | gpg --batch --import
export GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d/ -f2)
git config --global user.signingkey $GPG_KEY_ID
git config --global commit.gpgSign true
git config --global user.email "automation@graycore.io"
git config --global user.name "Beep Boop"
BRANCH="chore/graduate-v${STABLE}"
git checkout -b "$BRANCH"
git commit --allow-empty \
-m "chore: graduate ${CURRENT} to ${STABLE}" \
-m "Release-As: ${STABLE}"
git push --force origin "$BRANCH"
EXISTING=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number // empty')
PR_BODY=$(cat <<EOF
Graduates the release line from \`${CURRENT}\` to a stable \`${STABLE}\`.
When this PR is merged to \`${{ github.event.repository.default_branch }}\`, release-please will pick up the \`Release-As\` footer below and open a release PR for \`v${STABLE}\`.
Release-As: ${STABLE}
EOF
)
if [ -z "$EXISTING" ]; then
gh pr create \
--base ${{ github.event.repository.default_branch }} \
--head "$BRANCH" \
--title "chore: graduate ${CURRENT} → ${STABLE}" \
--body "$PR_BODY"
else
gh pr edit "$EXISTING" --body "$PR_BODY"
echo "PR #$EXISTING already exists for $BRANCH — updated body"
fi