deploy to CloudFlare pages using GH actions #60
Workflow file for this run
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: Build & deploy to S3 | |
on: | |
push: | |
branches: | |
- deploy-to-cloudflare | |
jobs: | |
build_and_deploy: | |
name: Build & deploy | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Generate typesafe-i18n files | |
run: npx typesafe-i18n --no-watch | |
- name: Semantic Release | |
id: release | |
run: | | |
version=$(npx semantic-release --branches main | grep 'Published release' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') | |
echo "version=$version" >> "$GITHUB_OUTPUT" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: npm run build | |
env: | |
PUBLIC_PLAUSIBLE_DOMAIN: ${{ secrets.PUBLIC_PLAUSIBLE_DOMAIN }} | |
PUBLIC_GAME_VERSION: ${{ steps.release.outputs.version }} | |
- name: Deploy to CloudFlare Pages | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
workingDirectory: .svelte-kit/cloudflare | |
command: pages deploy --project-name=julia-sanfrancisco |