Skip to content

Commit 17a11de

Browse files
committed
ci: restructure master and pr workflows
Master and PR workflows now use shared steps in order to separate the release workflow.
1 parent 2bcf015 commit 17a11de

File tree

6 files changed

+55
-27
lines changed

6 files changed

+55
-27
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name: Build and Lint
22
on:
3-
schedule:
4-
# runs every monday at midnight
5-
- cron: "0 0 * * 1"
6-
push:
7-
branches:
8-
- master
9-
pull_request:
3+
workflow_call:
4+
inputs:
5+
rust_cache_prefix:
6+
description: "Cache busting prefix for Rust dependencies"
7+
default: "v0-rust"
8+
type: string
9+
workflow_dispatch:
1010
env:
1111
# increment this manually to force cache eviction
12-
RUST_CACHE_PREFIX: "v0-rust"
12+
RUST_CACHE_PREFIX: ${{ inputs.rust_cache_prefix }}
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.ref }}
@@ -226,13 +226,3 @@ jobs:
226226
227227
- name: Test with embed feature
228228
run: cargo test --workspace --release --features closure,embed,anyhow --no-fail-fast
229-
230-
release:
231-
name: Create Release
232-
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
233-
needs: [lint, build, test-embed]
234-
permissions:
235-
id-token: write
236-
contents: write
237-
pull-requests: write
238-
uses: extphprs/ext-php-rs/.github/workflows/release-plz.yml@master

.github/workflows/coverage.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ on:
33
push:
44
branches-ignore:
55
- "release-plz-*"
6-
pull_request:
7-
branches-ignore:
8-
- "release-plz-*"
6+
workflow_call:
7+
workflow_dispatch:
98
env:
109
# increment this manually to force cache eviction
1110
RUST_CACHE_PREFIX: "v0-rust"

.github/workflows/docs.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
name: Deploy documentation
22
on:
3+
workflow_call:
34
workflow_dispatch:
4-
# runs every monday at midnight
5-
schedule:
6-
- cron: "0 0 * * 1"
7-
push:
8-
branches:
9-
- master
105

116
jobs:
127
docs:

.github/workflows/master.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Master Branch Workflow
2+
on:
3+
push:
4+
branches:
5+
- master
6+
workflow_dispatch:
7+
8+
jobs:
9+
build_and_lint:
10+
name: Build and Lint
11+
uses: ./.github/workflows/build.yml
12+
release:
13+
name: Create Release (MR)
14+
needs: [build_and_lint]
15+
uses: ./.github/workflows/release-plz.yml
16+
docs:
17+
name: Build and Deploy Documentation
18+
needs: [release]
19+
if: needs.release.outputs.release_created == 'true'
20+
permissions:
21+
id-token: write
22+
contents: write
23+
pull-requests: write
24+
uses: ./.github/workflows/docs.yml
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Merge Request Workflow
2+
on:
3+
pull_request:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build_and_lint:
8+
name: Build and Lint
9+
uses: ./.github/workflows/build.yml
10+
coverage:
11+
name: Code Coverage
12+
if: ${{ ! startsWith(github.head_ref, 'release-plz-') }}
13+
uses: ./.github/workflows/coverage.yml

.github/workflows/release-plz.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ permissions:
66

77
on:
88
workflow_call:
9+
outputs:
10+
release_created:
11+
description: "Indicates if a release was created"
12+
value: ${{ jobs.release-plz-release.outputs.release_created }}
913
workflow_dispatch:
1014

1115
jobs:
@@ -15,6 +19,8 @@ jobs:
1519
if: github.ref == 'refs/heads/master'
1620
permissions:
1721
id-token: write
22+
outputs:
23+
release_created: ${{ steps.release-plz.outputs.release_created }}
1824
env:
1925
clang: "17"
2026
php_version: "8.4"
@@ -53,6 +59,7 @@ jobs:
5359
uses: rust-lang/crates-io-auth-action@v1
5460
id: auth
5561
- name: Run release-plz
62+
id: release-plz
5663
uses: release-plz/[email protected]
5764
with:
5865
command: release

0 commit comments

Comments
 (0)