Deploy to CloudFlare Pages #7
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: Deploy to CloudFlare Pages | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/pages.yml' | |
- 'src/**.rs' | |
- 'build.rs' | |
- 'input.css' | |
- 'package.json' | |
- 'tailwind.config.js' | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: macos-15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: nightly-2025-01-10 | |
target: wasm32-unknown-unknown | |
- uses: Swatinem/rust-cache@v2 | |
- name: Pre Build | |
run: | | |
npm i | |
- name: Build | |
run: | | |
cargo install --locked cargo-leptos | |
RUSTFLAGS="--cfg erase_components" cargo leptos serve -r | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Show artifact | |
run: | | |
ls -l . | |
ls -l ./dist | |
- name: Unpack artifact | |
run: | | |
tar -xvf ./dist/*.tar.gz -C ./artifact | |
- name: Show unpacked artifact | |
run: | | |
ls -l . | |
ls -l ./artifact | |
- name: Deploy | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
# command: pages deploy ./artifact --project-name=peru |