Skip to content

Commit de21e61

Browse files
feat: Add release router workflow.
1 parent ce13f38 commit de21e61

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

.github/workflows/release-feature-branch.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: Release (feature branch)
22

3-
on:
4-
push:
5-
branches-ignore:
6-
- main
7-
pull_request: {}
3+
on: workflow_call
84

95
jobs:
106
test:

.github/workflows/release-latest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Release (latest)
22

3-
on: workflow_dispatch
3+
on: workflow_call
44

55
jobs:
66
test:

.github/workflows/router.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release Router
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
detect:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
target: ${{ steps.route.outputs.target }}
15+
16+
steps:
17+
- name: Route release
18+
id: route
19+
run: |
20+
EVENT="${{ github.event_name }}"
21+
BRANCH="${GITHUB_REF##*/}"
22+
23+
if [[ "$EVENT" == "workflow_dispatch" && "$BRANCH" == "main" ]]; then
24+
echo "target=latest" >> $GITHUB_OUTPUT
25+
else
26+
echo "target=feature" >> $GITHUB_OUTPUT
27+
fi
28+
29+
run-feature:
30+
needs: detect
31+
if: needs.detect.outputs.target == 'feature'
32+
uses: ./.github/workflows/release-feature-branch.yml
33+
34+
run-latest:
35+
needs: detect
36+
if: needs.detect.outputs.target == 'latest'
37+
uses: ./.github/workflows/release-latest.yml

0 commit comments

Comments
 (0)