From fc8b4657d08397c99fbdc734dd822e381a63d4a3 Mon Sep 17 00:00:00 2001 From: Milos Kaurin <2141359+Kaurin@users.noreply.github.com> Date: Sat, 30 Dec 2023 08:21:02 +0000 Subject: [PATCH] Explicit Github Workflow Switches --- .github/workflows/on_push_dev.yml | 2 ++ .github/workflows/on_push_main.yml | 2 ++ .github/workflows/on_release.yml | 14 +++++++++++++- .github/workflows/reusable_workflow.yml | 20 +++++++++++++------- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/on_push_dev.yml b/.github/workflows/on_push_dev.yml index 034adb4..9341a76 100644 --- a/.github/workflows/on_push_dev.yml +++ b/.github/workflows/on_push_dev.yml @@ -21,6 +21,8 @@ jobs: with: runner: self-hosted minimal_sample_size: true + testing_release: true + main_release: false secrets: GOOGLE_CREDS: ${{ secrets.GOOGLE_CREDS }} ASSETS: ${{ secrets.ASSETS }} diff --git a/.github/workflows/on_push_main.yml b/.github/workflows/on_push_main.yml index 24d6ae0..deb49ca 100644 --- a/.github/workflows/on_push_main.yml +++ b/.github/workflows/on_push_main.yml @@ -17,6 +17,8 @@ jobs: with: runner: 'ubuntu-22.04' minimal_sample_size: true + testing_release: false + main_release: false secrets: GOOGLE_CREDS: ${{ secrets.GOOGLE_CREDS }} ASSETS: ${{ secrets.ASSETS }} diff --git a/.github/workflows/on_release.yml b/.github/workflows/on_release.yml index 04e4ac1..2adf6ef 100644 --- a/.github/workflows/on_release.yml +++ b/.github/workflows/on_release.yml @@ -10,11 +10,23 @@ on: workflow_dispatch: jobs: - call_reusable_workflow: + dry_run: + uses: ./.github/workflows/reusable_workflow.yml + with: + runner: ${{ startsWith( github.ref_name, 'test' ) && 'self-hosted' || 'ubuntu-22.04' }} + minimal_sample_size: true + testing_release: true + main_release: false + secrets: + GOOGLE_CREDS: ${{ secrets.GOOGLE_CREDS }} + ASSETS: ${{ secrets.ASSETS }} + main_release: uses: ./.github/workflows/reusable_workflow.yml with: runner: ${{ startsWith( github.ref_name, 'test' ) && 'self-hosted' || 'ubuntu-22.04' }} minimal_sample_size: false + testing_release: false + main_release: true secrets: GOOGLE_CREDS: ${{ secrets.GOOGLE_CREDS }} ASSETS: ${{ secrets.ASSETS }} diff --git a/.github/workflows/reusable_workflow.yml b/.github/workflows/reusable_workflow.yml index 9443bdf..1f65979 100644 --- a/.github/workflows/reusable_workflow.yml +++ b/.github/workflows/reusable_workflow.yml @@ -12,6 +12,12 @@ on: minimal_sample_size: required: true type: boolean + testing_release: + required: true + type: boolean + main_release: + required: true + type: boolean secrets: GOOGLE_CREDS: required: true @@ -106,21 +112,21 @@ jobs: Staging/Checksums/*.sha256sum - name: Package to Exe installer (release) - if: ${{ inputs.runner != 'self-hosted' }} + if: ${{ inputs.main_release }} run: | cd Staging makensis -V4 -DVERSION=$GITHUB_REF rs-liveries-rendered.nsi mv "RS Liveries.exe" "RS_Liveries_$GITHUB_REF_NAME.exe" - name: Package to Exe installer (non-main release) - if: ${{ inputs.runner == 'self-hosted' }} + if: ${{ inputs.testing_release }} run: | cd Staging makensis -V4 -DVERSION=$GITHUB_REF rs-liveries-rendered.nsi mv "RS Liveries.exe" "RS_Liveries_testing.exe" - name: Create 'testing' tag (non-main release) - if: ${{ inputs.runner == 'self-hosted' }} + if: ${{ inputs.testing_release }} uses: EndBug/latest-tag@latest with: # You can change the name of the tag or branch with this input. @@ -128,13 +134,13 @@ jobs: ref: testing - name: Delete testing release (non-main release) - if: ${{ inputs.runner == 'self-hosted' }} + if: ${{ inputs.testing_release }} uses: cb80/delrel@latest with: tag: testing - name: Create a "testing" release (non-main release) - if: ${{ inputs.runner == 'self-hosted' }} + if: ${{ inputs.testing_release }} uses: ncipollo/release-action@v1 with: prerelease: true @@ -145,7 +151,7 @@ jobs: - name: Upload Assets to Github Releases (non-main release) uses: softprops/action-gh-release@v1 - if: ${{ inputs.runner == 'self-hosted' }} + if: ${{ inputs.testing_release }} with: tag_name: testing files: | @@ -154,7 +160,7 @@ jobs: - name: Upload Assets to Github Releases (main release) uses: softprops/action-gh-release@v1 - if: ${{ inputs.runner != 'self-hosted' && inputs.minimal_sample_size == false }} + if: ${{ inputs.main_release }} with: files: | Staging/RS_Liveries_${{ github.ref_name }}.exe