From 6357aa2419416b82e51218a7be58d1dd49ef91da Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 5 Aug 2023 00:58:09 -0700 Subject: [PATCH] factor out release package logic --- .github/workflows/build.yml | 22 ++---------- .github/workflows/github-release.yml | 40 ++++------------------ .github/workflows/package.yml | 51 ++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/package.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 051fc55b7..3f2017324 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,26 +7,10 @@ jobs: uses: ./.github/workflows/test.yml secrets: inherit - package-linux: - name: Linux package - uses: ./.github/workflows/build-linux.yml - with: - artifact-name: dfhack-linux64-build - append-date-and-hash: true - cache-id: release - stonesense: true - docs: true - secrets: inherit - - package-win64: - name: Win64 package - uses: ./.github/workflows/build-windows.yml + package: + uses: ./.github/workflows/package.yml with: - artifact-name: dfhack-win64-build - append-date-and-hash: true - cache-id: release - stonesense: true - docs: true + dfhack_ref: ${{ github.ref }} secrets: inherit docs: diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 56bc26702..2d8e55335 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -12,36 +12,18 @@ on: required: true jobs: - package-win64: - name: Build win64 release - uses: ./.github/workflows/build-windows.yml + package: + uses: ./.github/workflows/package.yml with: - artifact-name: win64-release dfhack_ref: ${{ github.event.inputs && github.event.inputs.ref || github.event.ref }} - cache-id: release + append-date-and-hash: false cache-readonly: true - stonesense: true - docs: true launchdf: true secrets: inherit - package-linux64: - name: Build linux64 release - uses: ./.github/workflows/build-linux.yml - with: - artifact-name: linux64-release - dfhack_ref: ${{ github.event.inputs && github.event.inputs.ref || github.event.ref }} - cache-id: release - cache-readonly: true - stonesense: true - docs: true - secrets: inherit - create-update-release: name: Draft GitHub release - needs: - - package-win64 - - package-linux64 + needs: package runs-on: ubuntu-latest permissions: contents: write @@ -63,23 +45,15 @@ jobs: tail -n $((CHANGELOG_LINES - 3)) docs/changelogs/${{ steps.gettag.outputs.name }}-github.txt >> release_body.md tail -n 2 .github/release_template.md >> release_body.md cat release_body.md - - name: Stage win64 release + - name: Stage release uses: actions/download-artifact@v3 - with: - name: win64-release - path: win64 - name: Create win64 release archive run: | - cd win64 + cd dfhack-windows64-build zip -r ../dfhack-${{ steps.gettag.outputs.name }}-Windows-64bit.zip . - - name: Stage linux64 release - uses: actions/download-artifact@v3 - with: - name: linux64-release - path: linux64 - name: Create linux64 release archive run: | - cd linux64 + cd dfhack-linux64-build tar cjf ../dfhack-${{ steps.gettag.outputs.name }}-Linux-64bit.tar.bz2 . - name: Create or update GitHub release uses: ncipollo/release-action@v1 diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 000000000..eba2f4f71 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,51 @@ +name: Package + +on: + workflow_call: + inputs: + dfhack_ref: + type: string + scripts_ref: + type: string + structures_ref: + type: string + append-date-and-hash: + type: boolean + default: true + cache-readonly: + type: boolean + default: false + launchdf: + type: boolean + default: false + +jobs: + package-win64: + name: Windows + uses: ./.github/workflows/build-windows.yml + with: + dfhack_ref: ${{ inputs.dfhack_ref }} + scripts_ref: ${{ inputs.scripts_ref }} + structures_ref: ${{ inputs.structures_ref }} + artifact-name: dfhack-windows64-build + append-date-and-hash: ${{ inputs.append-date-and-hash }} + cache-id: release + cache-readonly: ${{ inputs.cache-readonly }} + stonesense: true + docs: true + secrets: inherit + + package-linux: + name: Linux + uses: ./.github/workflows/build-linux.yml + with: + dfhack_ref: ${{ inputs.dfhack_ref }} + scripts_ref: ${{ inputs.scripts_ref }} + structures_ref: ${{ inputs.structures_ref }} + artifact-name: dfhack-linux64-build + append-date-and-hash: ${{ inputs.append-date-and-hash }} + cache-id: release + cache-readonly: ${{ inputs.cache-readonly }} + stonesense: true + docs: true + secrets: inherit