From 996688c4aed6872b41d3bcec157cc8e5acca1cc9 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 5 Aug 2023 23:25:10 -0700 Subject: [PATCH] make the workflows repository agnostic --- .github/workflows/build-linux.yml | 6 +++--- .github/workflows/build-windows.yml | 6 +++--- .github/workflows/build.yml | 5 +++++ .github/workflows/lint.yml | 4 ++-- .github/workflows/steam-deploy.yml | 4 +--- .github/workflows/test.yml | 2 +- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index f7088a234..96d57a41d 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -74,7 +74,7 @@ jobs: - name: Clone DFHack uses: actions/checkout@v3 with: - repository: 'DFHack/dfhack' + repository: ${{ inputs.dfhack_ref && github.repository || 'DFHack/dfhack' }} ref: ${{ inputs.dfhack_ref }} submodules: true fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} @@ -82,14 +82,14 @@ jobs: if: inputs.scripts_ref uses: actions/checkout@v3 with: - repository: 'DFHack/scripts' + repository: ${{ inputs.scripts_ref && github.repository || 'DFHack/scripts' }} ref: ${{ inputs.scripts_ref }} path: scripts - name: Clone structures if: inputs.structures_ref uses: actions/checkout@v3 with: - repository: 'DFHack/df-structures' + repository: ${{ inputs.structures_ref && github.repository || 'DFHack/df-structures' }} ref: ${{ inputs.structures_ref }} path: library/xml - name: Fetch ccache diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 50d7f6936..f73900c26 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -57,7 +57,7 @@ jobs: - name: Clone DFHack uses: actions/checkout@v3 with: - repository: 'DFHack/dfhack' + repository: ${{ inputs.dfhack_ref && github.repository || 'DFHack/dfhack' }} ref: ${{ inputs.dfhack_ref }} submodules: true fetch-depth: 0 @@ -65,14 +65,14 @@ jobs: if: inputs.scripts_ref uses: actions/checkout@v3 with: - repository: 'DFHack/scripts' + repository: ${{ inputs.scripts_ref && github.repository || 'DFHack/scripts' }} ref: ${{ inputs.scripts_ref }} path: scripts - name: Clone structures if: inputs.structures_ref uses: actions/checkout@v3 with: - repository: 'DFHack/df-structures' + repository: ${{ inputs.structures_ref && github.repository || 'DFHack/df-structures' }} ref: ${{ inputs.structures_ref }} path: library/xml - name: Get 3rd party SDKs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f2017324..10a6d332d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,8 @@ on: [push, pull_request] jobs: test: uses: ./.github/workflows/test.yml + with: + dfhack_ref: ${{ github.ref }} secrets: inherit package: @@ -16,6 +18,7 @@ jobs: docs: uses: ./.github/workflows/build-linux.yml with: + dfhack_ref: ${{ github.ref }} platform-files: false common-files: false docs: true @@ -23,6 +26,8 @@ jobs: lint: uses: ./.github/workflows/lint.yml + with: + dfhack_ref: ${{ github.ref }} secrets: inherit check-pr: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d299da573..77be37f37 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: - name: Clone DFHack uses: actions/checkout@v3 with: - repository: 'DFHack/dfhack' + repository: ${{ inputs.dfhack_ref && github.repository || 'DFHack/dfhack' }} ref: ${{ inputs.dfhack_ref }} - name: Get scripts submodule ref if: '!inputs.scripts_ref' @@ -28,7 +28,7 @@ jobs: - name: Clone scripts uses: actions/checkout@v3 with: - repository: 'DFHack/scripts' + repository: ${{ inputs.scripts_ref && github.repository || 'DFHack/scripts' }} ref: ${{ inputs.scripts_ref || steps.scriptssubmoduleref.outputs.ref }} path: scripts - name: Check whitespace diff --git a/.github/workflows/steam-deploy.yml b/.github/workflows/steam-deploy.yml index 70d061221..2df81d45d 100644 --- a/.github/workflows/steam-deploy.yml +++ b/.github/workflows/steam-deploy.yml @@ -68,8 +68,6 @@ jobs: runs-on: ubuntu-latest concurrency: steam steps: - - name: Get tag - run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Stage depot files uses: actions/download-artifact@v3 - name: Steam deploy @@ -78,7 +76,7 @@ jobs: username: ${{ secrets.STEAM_USERNAME }} configVdf: ${{ secrets.STEAM_CONFIG_VDF}} appId: 2346660 - buildDescription: ${{ github.event.inputs && github.event.inputs.version || env.TAG }} + buildDescription: ${{ github.event.inputs && github.event.inputs.version || github.ref_name }} rootPath: . depot1Path: common-depot depot2Path: win64-depot diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0934d6d00..9e58a649e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,7 +78,7 @@ jobs: - name: Clone DFHack uses: actions/checkout@v3 with: - repository: 'DFHack/dfhack' + repository: ${{ inputs.dfhack_ref && github.repository || 'DFHack/dfhack' }} ref: ${{ inputs.dfhack_ref }} - name: Detect DF version shell: bash