diff --git a/.github/workflows/amalgamate.yml b/.github/workflows/amalgamate.yml index 0686bb8..62f61f0 100644 --- a/.github/workflows/amalgamate.yml +++ b/.github/workflows/amalgamate.yml @@ -4,10 +4,7 @@ permissions: contents: write on: - push: - tags: - - "v*.*.*" - workflow_dispatch: + workflow_call: jobs: amalgamate: diff --git a/.github/workflows/cmake-builds-mac-linux.yml b/.github/workflows/cmake-builds-mac-linux.yml index e3555dc..1997e77 100644 --- a/.github/workflows/cmake-builds-mac-linux.yml +++ b/.github/workflows/cmake-builds-mac-linux.yml @@ -5,9 +5,11 @@ on: branches: [ master ] pull_request: branches: [ master ] - workflow_run: - workflows: [ Amalgamate Goose ] - types: [ completed ] + workflow_call: + inputs: + release: + required: true + type: boolean workflow_dispatch: jobs: @@ -27,22 +29,14 @@ jobs: - name: Initial checkout uses: actions/checkout@v3 - - name: "[Release] Check status of Amalgamate Goose" - if: ${{ github.event.workflow_run.conclusion == 'failure' }} - uses: actions/github-script@v6 - with: - script: | - core.setFailed('Amalgamate Goose workflow failed during release') - - name: "[Release] Download single header Goose" - uses: dawidd6/action-download-artifact@v2 - if: ${{ env.AMALGAMATING_PASSED == 'true' }} + if: inputs.release + uses: actions/download-artifact@v3 with: - workflow: amalgamate.yml name: goose-all - name: "[Release] Replace Goose with amalgamated single header" - if: ${{ env.AMALGAMATING_PASSED == 'true' }} + if: inputs.release run: mv -f goose.hpp ./include/gos/goose.hpp - name: Configure compiler @@ -63,7 +57,3 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build run: ./test/test-goose - - - name: "[Release] Call release workflow" - if: ${{ env.AMALGAMATING_PASSED == 'true' }} - uses: ./.github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..20aab03 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +name: Publish artifacts + +permissions: + contents: write + +on: + workflow_call: + +jobs: + publish: + name: Publish Goose + runs-on: ubuntu-latest + steps: + - name: Initial checkout + uses: actions/checkout@v3 + + - name: Download single header Goose + uses: actions/download-artifact@v3 + with: + name: goose-all + + - name: Release Goose + uses: softprops/action-gh-release@v1 + with: + files: | + goose.hpp + LICENSE + README.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f5961c6..9d882a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,37 +1,21 @@ -name: Release Goose - -permissions: - contents: write +name: 'Release Goose' on: - workflow_call: + push: + tags: + - "v*.*.*" + workflow_dispatch: jobs: - debug_info: - name: Debug Info - runs-on: ubuntu-latest - steps: - - name: Print Github context - run: echo '${{ toJSON(github) }}' - - release: - name: Release Goose - runs-on: ubuntu-latest - needs: debug_info - steps: - - name: Initial checkout - uses: actions/checkout@v3 + call-amalgamate: + uses: ./.github/workflows/amalgamate.yml - - name: Download single header Goose - uses: dawidd6/action-download-artifact@v2 - with: - workflow: amalgamate.yml - name: goose-all + call-cmake-builds-mac-linux: + needs: call-amalgamate + uses: ./.github/workflows/cmake-builds-mac-linux.yml + with: + release: true - - name: Release Goose - uses: softprops/action-gh-release@v1 - with: - files: | - goose.hpp - LICENSE - README.md + call-upload-artifact: + needs: call-cmake-builds-mac-linux + uses: ./.github/workflows/publish.yml