ci: sentinel step for env pipeline success #15
3 changed files with 69 additions and 0 deletions
13
.github/workflows/backend-pipeline.yml
vendored
13
.github/workflows/backend-pipeline.yml
vendored
|
@ -6,6 +6,9 @@ on:
|
||||||
task-version:
|
task-version:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
outputs:
|
||||||
|
pipeline-success:
|
||||||
|
value: ${{ jobs.notify-success.outputs.pipeline_success }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
ROTINI_CI: 1
|
ROTINI_CI: 1
|
||||||
|
@ -85,3 +88,13 @@ jobs:
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
task be:test
|
task be:test
|
||||||
|
notify-success:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Notify success
|
||||||
|
needs: [lint, test]
|
||||||
|
steps:
|
||||||
|
- id: set-output
|
||||||
|
working-directory: /
|
||||||
|
run: echo "pipeline_success=true" >> "$GITHUB_OUTPUT"
|
||||||
|
outputs:
|
||||||
|
pipeline_success: ${{ steps.set-output.outputs.pipeline_success }}
|
||||||
|
|
43
.github/workflows/ci.yml
vendored
43
.github/workflows/ci.yml
vendored
|
@ -58,3 +58,46 @@ jobs:
|
||||||
task-version: ${{ needs.preflight.outputs.task_version }}
|
task-version: ${{ needs.preflight.outputs.task_version }}
|
||||||
needs: preflight
|
needs: preflight
|
||||||
if: needs.preflight.outputs.fe_changed == 'true'
|
if: needs.preflight.outputs.fe_changed == 'true'
|
||||||
|
frontend-ok:
|
||||||
|
name: Frontend Pipeline Success
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [frontend, preflight]
|
||||||
|
if: |
|
||||||
|
always()
|
||||||
|
&& (
|
||||||
|
needs.frontend.outputs.pipeline-success == 'true'
|
||||||
|
|| needs.preflight.outputs.fe_changed == 'false'
|
||||||
|
)
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
if [ "${{ needs.preflight.outputs.fe_changed }}" == "false" ]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "${{ needs.frontend.outputs.pipeline-success }}" == "true" ]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
backend-ok:
|
||||||
|
name: Backend Pipeline Success
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [backend, preflight]
|
||||||
|
if: |
|
||||||
|
always()
|
||||||
|
&& (
|
||||||
|
needs.backend.outputs.pipeline-success == 'true'
|
||||||
|
|| needs.preflight.outputs.be_changed == 'false'
|
||||||
|
)
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
if [ "${{ needs.preflight.outputs.be_changed }}" == "false" ]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "${{ needs.backend.outputs.pipeline-success }}" == "true" ]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
|
13
.github/workflows/frontend-pipeline.yml
vendored
13
.github/workflows/frontend-pipeline.yml
vendored
|
@ -6,6 +6,9 @@ on:
|
||||||
task-version:
|
task-version:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
outputs:
|
||||||
|
pipeline-success:
|
||||||
|
value: ${{ jobs.notify-success.outputs.pipeline_success }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: lts/hydrogen
|
NODE_VERSION: lts/hydrogen
|
||||||
|
@ -177,6 +180,16 @@ jobs:
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: `:eyes: Branch deployed at ${process.env.DRAFT_URL}`
|
body: `:eyes: Branch deployed at ${process.env.DRAFT_URL}`
|
||||||
})
|
})
|
||||||
|
notify-success:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Notify success
|
||||||
|
needs: [lint, test, typecheck, build]
|
||||||
|
steps:
|
||||||
|
- id: set-output
|
||||||
|
working-directory: /
|
||||||
|
run: echo "pipeline_success=true" >> "$GITHUB_OUTPUT"
|
||||||
|
outputs:
|
||||||
|
pipeline_success: ${{ steps.set-output.outputs.pipeline_success }}
|
||||||
fe-deploy:
|
fe-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Deploy
|
name: Deploy
|
||||||
|
|
Reference in a new issue