Skip to content

Commit

Permalink
Explicit Github Workflow Switches
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaurin authored Dec 30, 2023
1 parent fd60673 commit fc8b465
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/on_push_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 2 additions & 0 deletions .github/workflows/on_push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
14 changes: 13 additions & 1 deletion .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
20 changes: 13 additions & 7 deletions .github/workflows/reusable_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,35 +112,35 @@ 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.
# Default: 'latest'
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
Expand All @@ -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: |
Expand All @@ -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
Expand Down

0 comments on commit fc8b465

Please sign in to comment.