The Rites of Deployment aka CD #573
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: The Rites of Deployment aka CD | |
on: | |
workflow_run: | |
workflows: [The Trial of Truth aka CI] | |
types: | |
- completed | |
branches: | |
- main | |
jobs: | |
deploy: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
concurrency: | |
group: cd-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Retrieving the Sacred Artifact | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
if_no_artifact_found: warn | |
run_id: ${{ github.event.workflow_run.id }} | |
name: the-edge-awakened | |
path: ./.svelte-kit/cloudflare | |
- name: Download Wrangler Configuration | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
if_no_artifact_found: warn | |
run_id: ${{ github.event.workflow_run.id }} | |
name: the-edge-config | |
path: ./ | |
- name: Check Artifacts | |
id: check_artifacts | |
run: | | |
if [ -d "./.svelte-kit/cloudflare" ] && [ -f "./wrangler.toml" ]; then | |
echo "artifacts_found=true" >> $GITHUB_ENV | |
else | |
echo "artifacts_found=false" >> $GITHUB_ENV | |
fi | |
- name: Invoking the Cloudflare Spirits | |
if: env.artifacts_found == 'true' | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy | |
preCommands: | | |
echo "${{ secrets.TRAKT_CLIENT_ID }}" | npx wrangler pages secret put TRAKT_CLIENT_ID | |
echo "${{ secrets.TRAKT_CLIENT_SECRET }}" | npx wrangler pages secret put TRAKT_CLIENT_SECRET | |
echo "${{ secrets.TRAKT_SESSION_SECRET }}" | npx wrangler pages secret put TRAKT_SESSION_SECRET |