Promote Staging to Production #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Promote Staging to Production | |
on: | |
workflow_dispatch: # Allows manual triggering from Github portal. | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check required secrets | |
run: | | |
if [ -z "${{ secrets.BUNNY_API_KEY }}" ] || [ -z "${{ secrets.APP_NAME }}" ] || [ -z "${{ secrets.STORAGE_ZONE_NAME }}" ]; then | |
echo "Error: One or more required secrets are missing." | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
# Important to set the secret-based env vars just in this deploy step to avoid secret exposure to 3rd-party code. | |
- name: Promote using BunnyCDN | |
run: node ./scripts/promote.js | |
env: | |
BUNNY_API_KEY: ${{ secrets.BUNNY_API_KEY }} | |
APP_NAME: ${{ secrets.APP_NAME }} | |
STORAGE_ZONE_NAME: ${{ secrets.STORAGE_ZONE_NAME }} |