Skip to content

Commit e686eb5

Browse files
ci: Bump version of modules when new module is released (#4040)
* ci: Bump version of modules when new module is released Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org> * fix: avoid injection in inputs Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org> --------- Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
1 parent 8aa3978 commit e686eb5

File tree

3 files changed

+80
-85
lines changed

3 files changed

+80
-85
lines changed

.github/workflows/bump-module-dependency.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

.github/workflows/bump-modules.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# ---------------------------------------
2+
# Bump module dependency is a workflow that bumps the dependency of a module to the latest version.
3+
# This is a reusable workflow and is used by the release-please workflow to bump the dependency of the module to the latest version.
4+
# ---------------------------------------
5+
name: bump module dependency
6+
permissions:
7+
actions: read
8+
contents: read
9+
10+
on:
11+
workflow_call:
12+
inputs:
13+
modulePath: { type: string, required: true }
14+
version: { type: string, required: true }
15+
16+
jobs:
17+
bump-module:
18+
name: Bump module dependency ${{ inputs.modulePath }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
23+
24+
- name: Setup go
25+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
26+
with:
27+
go-version-file: ${{ inputs.modulePath }}/go.mod
28+
check-latest: true
29+
30+
- name: Update internal module
31+
env:
32+
VERSION: ${{ inputs.version }}
33+
MODULE_PATH: ${{ inputs.modulePath }}
34+
run: |
35+
export GOWORK=off
36+
go get github.com/thomaspoignant/go-feature-flag/${MODULE_PATH}@${VERSION }
37+
go mod tidy
38+
go mod vendor
39+
go mod verify
40+
41+
- name: Create Pull Request to bump module
42+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
43+
env:
44+
VERSION: ${{ inputs.version }}
45+
MODULE_PATH: ${{ inputs.modulePath }}
46+
with:
47+
branch: bump-module-${MODULE_PATH}-${VERSION}
48+
title: "chore(dependency): Bump module ${MODULE_PATH} ${VERSION}"
49+
body: |
50+
Automated pull request to bump module ${MODULE_PATH} ${VERSION}
51+
commit-message: "chore(dependency): Bump module ${MODULE_PATH} ${VERSION}"
52+
assignees: thomaspoignant
53+
draft: false
54+
signoff: true
55+
delete-branch: true
56+
base: main
57+
labels: automerge
58+
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

.github/workflows/release-please.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,32 @@ permissions:
1111
jobs:
1212
release-please:
1313
runs-on: ubuntu-latest
14+
outputs:
15+
module_evaluation_released: ${{ steps.release.outputs['modules/evaluation--release_created'] }}
16+
module_evaluation_version: ${{ steps.release.outputs['modules/evaluation--version'] }}
17+
module_core_released: ${{ steps.release.outputs['modules/core--release_created'] }}
18+
module_core_version: ${{ steps.release.outputs['modules/core--version'] }}
1419
steps:
1520
- uses: googleapis/release-please-action@c2a5a2bd6a758a0937f1ddb1e8950609867ed15c # v4.3.0
21+
id: release
1622
with:
1723
# See: https://github.com/googleapis/release-please
1824
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
1925
config-file: .github/release-please/release-please-config.json
2026
manifest-file: .github/release-please/.release-please-manifest.json
27+
28+
bump-module-evaluation:
29+
if: ${{ needs.release-please.outputs.module_evaluation_released == 'true' }}
30+
uses: ./.github/workflows/bump-modules.yml
31+
needs: release-please
32+
with:
33+
modulePath: module/evaluation
34+
version: ${{ needs.release-please.outputs.module_evaluation_version }}
35+
36+
bump-module-core:
37+
if: ${{ needs.release-please.outputs.module_core_released == 'true' }}
38+
uses: ./.github/workflows/bump-modules.yml
39+
needs: release-please
40+
with:
41+
modulePath: module/core
42+
version: ${{ needs.release-please.outputs.module_core_version }}

0 commit comments

Comments
 (0)