Skip to content

Commit 19bb58b

Browse files
committed
test: trim release workflow to reproduce release/v* branch-creation 422
1 parent 73d7d2f commit 19bb58b

1 file changed

Lines changed: 6 additions & 97 deletions

File tree

Lines changed: 6 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,23 @@
11
name: Release Please
22

3+
# TEST BRANCH ONLY (test/repro-release-422): trimmed to reproduce the release/v*
4+
# branch-creation 422 (SLK-130224). The Tag release, label removal and release-please
5+
# jobs are stripped so no v* tag is created (which would trigger release.yaml/mkdocs).
6+
# Do not merge this workflow variant.
37
on:
48
push:
59
branches:
610
- main
711
- 'release/v*'
8-
workflow_dispatch:
9-
inputs:
10-
version:
11-
required: true
12-
description: 'Release version without the "v" prefix (e.g., 0.51.0)'
13-
type: string
12+
- 'test/repro-release-422'
1413

1514
jobs:
16-
release-please:
17-
runs-on: ubuntu-2404-2core
18-
if: ${{ !startsWith(github.event.head_commit.message, 'release:') && !github.event.inputs.version }}
19-
steps:
20-
# GITHUB_TOKEN cannot trigger workflows on PRs it creates, so the release PR
21-
# would not run CI — generate a GitHub App installation token instead.
22-
- name: Generate token
23-
id: app-token
24-
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
25-
with:
26-
client-id: ${{ secrets.REPO_TRIVY_WRITE_GH_APP_CLIENT_ID }}
27-
private-key: ${{ secrets.REPO_TRIVY_WRITE_GH_APP_PRIVATE_KEY }}
28-
permission-contents: write
29-
permission-pull-requests: write
30-
31-
- name: Release Please
32-
id: release
33-
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
34-
with:
35-
token: ${{ steps.app-token.outputs.token }}
36-
target-branch: ${{ github.ref_name }}
37-
38-
manual-release-please:
39-
runs-on: ubuntu-2404-2core
40-
if: ${{ github.event.inputs.version }}
41-
steps:
42-
# GITHUB_TOKEN cannot trigger workflows on PRs it creates, so the release PR
43-
# would not run CI — generate a GitHub App installation token instead.
44-
- name: Generate token
45-
id: app-token
46-
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
47-
with:
48-
client-id: ${{ secrets.REPO_TRIVY_WRITE_GH_APP_CLIENT_ID }}
49-
private-key: ${{ secrets.REPO_TRIVY_WRITE_GH_APP_PRIVATE_KEY }}
50-
permission-contents: write
51-
permission-pull-requests: write
52-
53-
- name: Install Release Please CLI
54-
run: npm install release-please -g
55-
56-
- name: Release Please
57-
env:
58-
RELEASE_VERSION: ${{ github.event.inputs.version }}
59-
APP_TOKEN: ${{ steps.app-token.outputs.token }}
60-
run: |
61-
release-please release-pr --repo-url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
62-
--token="$APP_TOKEN" \
63-
--release-as="$RELEASE_VERSION" \
64-
--target-branch="$GITHUB_REF_NAME"
65-
6615
release-tag:
6716
runs-on: ubuntu-2404-2core
6817
# Skip the branch-creation push (created == true) to avoid re-running on the duplicate tag.
6918
if: ${{ startsWith(github.event.head_commit.message, 'release:') && !github.event.created }}
7019
steps:
71-
# Since skip-github-release is specified, the outputs of googleapis/release-please-action cannot be used.
72-
# Therefore, we need to parse the version ourselves.
73-
- name: Extract version and PR number from commit message
20+
- name: Extract version from commit message
7421
id: extract_info
7522
shell: bash
7623
env:
@@ -79,11 +26,8 @@ jobs:
7926
# Take only the first line to avoid git trailers (e.g. Co-authored-by) breaking $GITHUB_OUTPUT
8027
FIRST_LINE=${COMMIT_MESSAGE%%$'\n'*}
8128
echo "version=$( echo "$FIRST_LINE" | sed 's/^release: v\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$/\1/' )" >> $GITHUB_OUTPUT
82-
echo "pr_number=$( echo "$FIRST_LINE" | sed 's/.*(\#\([0-9]\+\)).*$/\1/' )" >> $GITHUB_OUTPUT
8329
echo "release_branch=release/v$( echo "$FIRST_LINE" | sed 's/^release: v\([0-9]\+\.[0-9]\+\).*$/\1/' )" >> $GITHUB_OUTPUT
8430
85-
# GITHUB_TOKEN cannot trigger the release workflow on the created tag —
86-
# generate a GitHub App installation token instead.
8731
- name: Generate token
8832
id: app-token
8933
if: ${{ steps.extract_info.outputs.version }}
@@ -93,21 +37,6 @@ jobs:
9337
private-key: ${{ secrets.REPO_TRIVY_WRITE_GH_APP_PRIVATE_KEY }}
9438
permission-contents: write
9539

96-
- name: Tag release
97-
if: ${{ steps.extract_info.outputs.version }}
98-
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
99-
env:
100-
VERSION: ${{ steps.extract_info.outputs.version }}
101-
with:
102-
github-token: ${{ steps.app-token.outputs.token }} # To trigger another workflow
103-
script: |
104-
await github.rest.git.createRef({
105-
owner: context.repo.owner,
106-
repo: context.repo.repo,
107-
ref: `refs/tags/v${process.env.VERSION}`,
108-
sha: context.sha
109-
});
110-
11140
# When v0.50.0 is released, a release branch "release/v0.50" is created.
11241
- name: Create release branch for patch versions
11342
if: ${{ endsWith(steps.extract_info.outputs.version, '.0') }}
@@ -125,23 +54,3 @@ jobs:
12554
ref: `refs/heads/${releaseBranch}`,
12655
sha: context.sha
12756
});
128-
129-
130-
# Since skip-github-release is specified, googleapis/release-please-action doesn't delete the label from PR.
131-
# This label prevents the subsequent PRs from being created. Therefore, we need to delete it ourselves.
132-
# cf. https://github.com/googleapis/release-please?tab=readme-ov-file#release-please-bot-does-not-create-a-release-pr-why
133-
- name: Remove the label from PR
134-
if: ${{ steps.extract_info.outputs.pr_number }}
135-
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
136-
env:
137-
PR_NUMBER: ${{ steps.extract_info.outputs.pr_number }}
138-
with:
139-
github-token: ${{ secrets.GITHUB_TOKEN }}
140-
script: |
141-
const prNumber = parseInt(process.env.PR_NUMBER, 10);
142-
github.rest.issues.removeLabel({
143-
owner: context.repo.owner,
144-
repo: context.repo.repo,
145-
issue_number: prNumber,
146-
name: 'autorelease: pending'
147-
});

0 commit comments

Comments
 (0)