Skip to content

Commit 21141bf

Browse files
committed
fix(ci): trigger release workflow on main branch push
release-please-action needs to run on branch pushes (not tag pushes) to properly create and manage Release PRs. When a Release PR is merged, it creates the tag and GitHub release, then builds binaries. Changes: - Trigger on push to main instead of tag push - Add pull-requests: write permission for creating Release PRs - Add release-please-action step before checkout/precompile - Make checkout and precompile conditional on release_created
1 parent 3f38e87 commit 21141bf

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main # limit to main, because pushes to pull-requested branches are triggered below
67
pull_request:
7-
branches: [main]
8+
# any pull request
89

910
permissions:
1011
contents: read
1112

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
1217
jobs:
1318
lint:
1419
name: Lint

.github/workflows/release.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,33 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- "v*"
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}
710

811
permissions:
912
contents: write
13+
pull-requests: write
1014
id-token: write
1115
attestations: write
1216

1317
jobs:
1418
release:
1519
runs-on: ubuntu-latest
1620
steps:
17-
- uses: actions/checkout@v4
21+
- name: Release Please
22+
id: release
23+
uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
24+
25+
- name: Checkout
26+
if: ${{ steps.release.outputs.release_created }}
27+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1828

19-
- uses: cli/gh-extension-precompile@v2
29+
- name: Build and upload binaries
30+
if: ${{ steps.release.outputs.release_created }}
31+
uses: cli/gh-extension-precompile@v2
2032
with:
2133
generate_attestations: true
2234
go_version_file: go.mod

0 commit comments

Comments
 (0)