Skip to content

Commit

Permalink
Add integration workflow for releasing with calls to another workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
SzymonZos committed Apr 25, 2022
1 parent 7298cb3 commit 772c452
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 53 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/amalgamate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ permissions:
contents: write

on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
workflow_call:

jobs:
amalgamate:
Expand Down
26 changes: 8 additions & 18 deletions .github/workflows/cmake-builds-mac-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
46 changes: 15 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 772c452

Please sign in to comment.