Skip to content

Commit b239a1f

Browse files
pditommasoclaude
andcommitted
Refactor GitHub Actions to use reusable workflows
- Convert build.yml to reusable workflow with workflow_call trigger - Convert release.yml to reusable workflow with should_release input - Add main.yml to orchestrate build and release in same runner instance - Maintain sequential execution: release only after successful build - Preserve conditional release logic for [release] commits on master 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9006f00 commit b239a1f

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
name: Gradle Build
22

33
on:
4-
push:
5-
branches:
6-
- 'master'
7-
pull_request:
8-
types: [opened, reopened, synchronize]
9-
workflow_dispatch:
4+
workflow_call:
105

116
jobs:
127
build:

.github/workflows/main.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
uses: ./.github/workflows/build.yml
14+
15+
release:
16+
needs: build
17+
if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[release]')
18+
uses: ./.github/workflows/release.yml
19+
with:
20+
should_release: true
21+
secrets: inherit

.github/workflows/release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
name: Release
2+
13
on:
2-
workflow_run:
3-
workflows: ["Gradle Build"]
4-
types: [completed]
5-
branches: [ master ]
4+
workflow_call:
5+
inputs:
6+
should_release:
7+
required: true
8+
type: boolean
9+
description: 'Whether to perform the release'
610

711
jobs:
812
release:
9-
if: github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_commit.message, '[release]')
13+
if: ${{ inputs.should_release }}
1014
runs-on: ubuntu-latest
1115

1216
steps:

0 commit comments

Comments
 (0)