Skip to content

Commit

Permalink
feat: reuse workflows, add skippable jobs
Browse files Browse the repository at this point in the history
- testing out reusable actions

- testing out skippable jobs by path
  • Loading branch information
Nick VanCise authored and Nick VanCise committed Dec 28, 2023
1 parent 2f5f48f commit 0a47cad
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
name: admin
name: Build Admin

on:
push:
branches: ['**']
workflow_call:

jobs:
pre_job:
continue-on-error: true
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content_newer'

build:
needs: pre_job
if: github.ref == 'refs/heads/master' || needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
defaults:
run:
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/auth.yml → .github/workflows/auth.workflow.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
name: auth
name: Build Auth

on:
push:
branches: ['**']
workflow_call:

jobs:
pre_job:
continue-on-error: true
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content_newer'

build:
needs: pre_job
if: github.ref == 'refs/heads/master' || needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
defaults:
run:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
name: Gbajs3
name: Build Gbajs3

on:
push:
branches: ['**']
workflow_call:

jobs:
pre_job:
continue-on-error: true
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content_newer'

build:
needs: pre_job
if: github.ref == 'refs/heads/master' || needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
defaults:
run:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/protected.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Protected

on:
push:
branches: ['master']
pull_request:
branches: ['master']

jobs:
call-admin:
uses: ./.github/workflows/admin.workflow.yml

call-auth:
uses: ./.github/workflows/auth.workflow.yml

call-gbajs3:
uses: ./.github/workflows/gbajs3.workflow.yml
44 changes: 44 additions & 0 deletions .github/workflows/unprotected.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Unprotected

on:
push:
branches: ['!master']
pull_request:
branches: ['!master']

jobs:
change-detect:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
admin: ${{ steps.filter.outputs.admin }}
auth: ${{ steps.filter.outputs.auth }}
gbajs3: ${{ steps.filter.outputs.gbajs3 }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
admin:
- 'docker/server/admin/**'
auth:
- 'docker/server/auth/**'
gbajs3:
- 'gbajs3/**'
call-admin:
needs: change-detect
if: steps.filter.outputs.admin == 'true'
uses: ./.github/workflows/admin.workflow.yml

call-auth:
needs: change-detect
if: steps.filter.outputs.auth == 'true'
uses: ./.github/workflows/auth.workflow.yml

call-gbajs3:
needs: change-detect
if: steps.filter.outputs.gbajs3 == 'true'
uses: ./.github/workflows/gbajs3.workflow.yml

0 comments on commit 0a47cad

Please sign in to comment.