|
| 1 | +name: staged-release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + deploy_prod: |
| 10 | + description: "Deploy to production after dev checks" |
| 11 | + required: false |
| 12 | + default: true |
| 13 | + type: boolean |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + validate: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup Python |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: "3.12" |
| 29 | + |
| 30 | + - name: Validate site structure and local references |
| 31 | + run: python tools/validate_site.py |
| 32 | + |
| 33 | + package: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + needs: validate |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Upload site artifact |
| 41 | + uses: actions/upload-artifact@v4 |
| 42 | + with: |
| 43 | + name: site-bundle |
| 44 | + path: | |
| 45 | + *.html |
| 46 | + assets/** |
| 47 | + bible-data/** |
| 48 | + manifest.webmanifest |
| 49 | + sw.js |
| 50 | + if-no-files-found: error |
| 51 | + |
| 52 | + deploy_dev: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: package |
| 55 | + environment: dev |
| 56 | + steps: |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Download site artifact |
| 61 | + uses: actions/download-artifact@v4 |
| 62 | + with: |
| 63 | + name: site-bundle |
| 64 | + path: dist |
| 65 | + |
| 66 | + - name: Setup Python |
| 67 | + uses: actions/setup-python@v5 |
| 68 | + with: |
| 69 | + python-version: "3.12" |
| 70 | + |
| 71 | + - name: Deploy to dev |
| 72 | + env: |
| 73 | + DEPLOY_WEBHOOK_URL: ${{ secrets.DEPLOY_WEBHOOK_URL }} |
| 74 | + DEPLOY_REGION: ${{ vars.DEPLOY_REGION }} |
| 75 | + BASE_URL: ${{ vars.BASE_URL }} |
| 76 | + run: | |
| 77 | + python tools/deploy_static.py \ |
| 78 | + --environment dev \ |
| 79 | + --region "${DEPLOY_REGION}" \ |
| 80 | + --artifact-path dist \ |
| 81 | + --manifest-path deploy/pages-manifest.json \ |
| 82 | + --base-url "${BASE_URL}" \ |
| 83 | + --webhook-url "${DEPLOY_WEBHOOK_URL}" |
| 84 | +
|
| 85 | + smoke_dev: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + needs: deploy_dev |
| 88 | + environment: dev |
| 89 | + steps: |
| 90 | + - name: Checkout |
| 91 | + uses: actions/checkout@v4 |
| 92 | + |
| 93 | + - name: Setup Python |
| 94 | + uses: actions/setup-python@v5 |
| 95 | + with: |
| 96 | + python-version: "3.12" |
| 97 | + |
| 98 | + - name: Smoke test dev endpoint |
| 99 | + env: |
| 100 | + BASE_URL: ${{ vars.BASE_URL }} |
| 101 | + run: python tools/smoke_check.py --base-url "${BASE_URL}" --label dev |
| 102 | + |
| 103 | + deploy_prod: |
| 104 | + runs-on: ubuntu-latest |
| 105 | + needs: smoke_dev |
| 106 | + if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.deploy_prod == 'true' }} |
| 107 | + environment: prod |
| 108 | + steps: |
| 109 | + - name: Checkout |
| 110 | + uses: actions/checkout@v4 |
| 111 | + |
| 112 | + - name: Download site artifact |
| 113 | + uses: actions/download-artifact@v4 |
| 114 | + with: |
| 115 | + name: site-bundle |
| 116 | + path: dist |
| 117 | + |
| 118 | + - name: Setup Python |
| 119 | + uses: actions/setup-python@v5 |
| 120 | + with: |
| 121 | + python-version: "3.12" |
| 122 | + |
| 123 | + - name: Deploy to prod |
| 124 | + env: |
| 125 | + DEPLOY_WEBHOOK_URL: ${{ secrets.DEPLOY_WEBHOOK_URL }} |
| 126 | + DEPLOY_REGION: ${{ vars.DEPLOY_REGION }} |
| 127 | + BASE_URL: ${{ vars.BASE_URL }} |
| 128 | + run: | |
| 129 | + python tools/deploy_static.py \ |
| 130 | + --environment prod \ |
| 131 | + --region "${DEPLOY_REGION}" \ |
| 132 | + --artifact-path dist \ |
| 133 | + --manifest-path deploy/pages-manifest.json \ |
| 134 | + --base-url "${BASE_URL}" \ |
| 135 | + --webhook-url "${DEPLOY_WEBHOOK_URL}" |
| 136 | +
|
| 137 | + smoke_prod: |
| 138 | + runs-on: ubuntu-latest |
| 139 | + needs: deploy_prod |
| 140 | + environment: prod |
| 141 | + steps: |
| 142 | + - name: Checkout |
| 143 | + uses: actions/checkout@v4 |
| 144 | + |
| 145 | + - name: Setup Python |
| 146 | + uses: actions/setup-python@v5 |
| 147 | + with: |
| 148 | + python-version: "3.12" |
| 149 | + |
| 150 | + - name: Smoke test prod endpoint |
| 151 | + env: |
| 152 | + BASE_URL: ${{ vars.BASE_URL }} |
| 153 | + run: python tools/smoke_check.py --base-url "${BASE_URL}" --label prod |
0 commit comments