|
| 1 | +# GitHub Actions Workflow for Continuous Integration and Continuous Delivery |
| 2 | +# |
| 3 | +# Documentation: |
| 4 | +# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions |
| 5 | +# - https://docs.github.com/en/actions/learn-github-actions/contexts |
| 6 | +# - https://docs.github.com/en/actions/learn-github-actions/expressions |
| 7 | +# - https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 8 | +# - https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts |
| 9 | +# - https://docs.github.com/en/actions/using-workflows/reusing-workflows |
| 10 | + |
| 11 | +name: CI/CD |
| 12 | + |
| 13 | +on: |
| 14 | + push: |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: write |
| 18 | + |
| 19 | +env: |
| 20 | + PRODUCTION_VCS_REF: refs/heads/master |
| 21 | + STAGING_VCS_REF: refs/heads/develop |
| 22 | + |
| 23 | +jobs: |
| 24 | + # -----BEGIN Workflow Configuration Job----- |
| 25 | + workflow_config: |
| 26 | + name: Workflow Configuration |
| 27 | + runs-on: ubuntu-22.04 |
| 28 | + |
| 29 | + outputs: |
| 30 | + PRODUCTION_VCS_REF: ${{ env.PRODUCTION_VCS_REF }} |
| 31 | + STAGING_VCS_REF: ${{ env.STAGING_VCS_REF }} |
| 32 | + |
| 33 | + steps: |
| 34 | + - run: "true" |
| 35 | + |
| 36 | + # -----END Workflow Configuration Job----- |
| 37 | + |
| 38 | + # -----BEGIN CI Job----- |
| 39 | + ci: |
| 40 | + name: CI |
| 41 | + needs: |
| 42 | + - workflow_config |
| 43 | + |
| 44 | + uses: ./.github/workflows/ci.yaml |
| 45 | + |
| 46 | + # -----END CI Job----- |
| 47 | + |
| 48 | + # -----BEGIN Release Job----- |
| 49 | + release: |
| 50 | + name: Release |
| 51 | + if: ${{ github.ref == needs.workflow_config.outputs.PRODUCTION_VCS_REF }} |
| 52 | + needs: |
| 53 | + - ci |
| 54 | + - workflow_config |
| 55 | + |
| 56 | + uses: ./.github/workflows/release.yaml |
| 57 | + with: |
| 58 | + create_git_tag_and_github_release: ${{ github.ref == needs.workflow_config.outputs.PRODUCTION_VCS_REF }} |
| 59 | + |
| 60 | + # -----END Release Job----- |
| 61 | + |
| 62 | + # -----BEGIN Deploy Job----- |
| 63 | + deploy: |
| 64 | + name: Deploy |
| 65 | + if: ${{ github.ref == needs.workflow_config.outputs.PRODUCTION_VCS_REF }} |
| 66 | + needs: |
| 67 | + - release |
| 68 | + - workflow_config |
| 69 | + |
| 70 | + uses: ./.github/workflows/deploy.yaml |
| 71 | + with: |
| 72 | + deploy_env: prod |
| 73 | + artifacts_path: ${{ needs.release.outputs.artifacts_path }} |
| 74 | + secrets: inherit |
| 75 | + |
| 76 | + # -----END Deploy Job----- |
0 commit comments