optimize CI triggers for build/test/release workflows (#315)

This commit is contained in:
Josh Thomas 2025-10-07 21:24:36 -05:00 committed by GitHub
parent a7acf05688
commit 02c92ff179
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 29 deletions

View file

@ -1,17 +1,10 @@
name: build
on:
pull_request:
branches:
- main
paths:
- .github/workflows/build.yml
- crates/**
- Cargo.lock
- Cargo.toml
push:
branches:
- main
- release/*
paths:
- .github/workflows/build.yml
- crates/**
@ -31,7 +24,7 @@ on:
type: string
concurrency:
group: build-${{ github.head_ref }}
group: build-${{ github.ref }}
cancel-in-progress: true
permissions:

View file

@ -6,7 +6,7 @@ on:
workflow_dispatch:
concurrency:
group: release-${{ github.head_ref }}
group: release-${{ github.ref }}
cancel-in-progress: true
permissions:
@ -22,16 +22,10 @@ jobs:
with:
version: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
test:
uses: ./.github/workflows/test.yml
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
with:
os: "macos-latest,ubuntu-latest,windows-latest"
release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [build, test]
needs: [build]
environment: release
permissions:
attestations: write

View file

@ -39,7 +39,7 @@ on:
type: string
concurrency:
group: test-${{ github.head_ref }}
group: test-${{ github.ref }}
cancel-in-progress: true
env:
@ -67,6 +67,14 @@ jobs:
activate-environment: true
enable-cache: true
- name: Determine OS targets
env:
HEAD_REF: ${{ github.head_ref }}
run: |
if [[ "$HEAD_REF" == release/* ]]; then
echo "OS=macos-latest,ubuntu-latest,windows-latest" >> $GITHUB_ENV
fi
- id: set-matrix
env:
OS: ${{ inputs.os }}

22
.github/zizmor.yml vendored
View file

@ -4,15 +4,15 @@ rules:
# test workflow does not produce artifacts to poison
- test.yml
# all caching is disabled when a tag is pushed
- build.yml:96:9
- build.yml:87:9
- build.yml:97:9
- build.yml:106:9
- build.yml:115:9
- build.yml:122:9
- build.yml:236:9
- build.yml:268:9
- build.yml:299:9
- build.yml:309:9
- build.yml:321:9
- build.yml:352:9
- build.yml:362:9
- build.yml:374:9
- build.yml:113:9
- build.yml:227:9
- build.yml:259:9
- build.yml:290:9
- build.yml:300:9
- build.yml:312:9
- build.yml:343:9
- build.yml:353:9
- build.yml:365:9