From 0a47cadb43e10f0373f1beb1c7f05a3442b3b6c7 Mon Sep 17 00:00:00 2001 From: Nick VanCise Date: Wed, 27 Dec 2023 21:17:34 -0800 Subject: [PATCH] feat: reuse workflows, add skippable jobs - testing out reusable actions - testing out skippable jobs by path --- .../{admin.yml => admin.workflow.yml} | 18 +------- .../workflows/{auth.yml => auth.workflow.yml} | 18 +------- .../{gbajs3.yml => gbajs3.workflow.yml} | 18 +------- .github/workflows/protected.yml | 17 +++++++ .github/workflows/unprotected.yml | 44 +++++++++++++++++++ 5 files changed, 67 insertions(+), 48 deletions(-) rename .github/workflows/{admin.yml => admin.workflow.yml} (61%) rename .github/workflows/{auth.yml => auth.workflow.yml} (63%) rename .github/workflows/{gbajs3.yml => gbajs3.workflow.yml} (59%) create mode 100644 .github/workflows/protected.yml create mode 100644 .github/workflows/unprotected.yml diff --git a/.github/workflows/admin.yml b/.github/workflows/admin.workflow.yml similarity index 61% rename from .github/workflows/admin.yml rename to .github/workflows/admin.workflow.yml index 5777ba0a..6b41a071 100644 --- a/.github/workflows/admin.yml +++ b/.github/workflows/admin.workflow.yml @@ -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: diff --git a/.github/workflows/auth.yml b/.github/workflows/auth.workflow.yml similarity index 63% rename from .github/workflows/auth.yml rename to .github/workflows/auth.workflow.yml index 8f017a88..be80b1b2 100644 --- a/.github/workflows/auth.yml +++ b/.github/workflows/auth.workflow.yml @@ -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: diff --git a/.github/workflows/gbajs3.yml b/.github/workflows/gbajs3.workflow.yml similarity index 59% rename from .github/workflows/gbajs3.yml rename to .github/workflows/gbajs3.workflow.yml index 4c4e58b1..7e2b886c 100644 --- a/.github/workflows/gbajs3.yml +++ b/.github/workflows/gbajs3.workflow.yml @@ -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: diff --git a/.github/workflows/protected.yml b/.github/workflows/protected.yml new file mode 100644 index 00000000..c3a41e95 --- /dev/null +++ b/.github/workflows/protected.yml @@ -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 diff --git a/.github/workflows/unprotected.yml b/.github/workflows/unprotected.yml new file mode 100644 index 00000000..49110adb --- /dev/null +++ b/.github/workflows/unprotected.yml @@ -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