Created
August 19, 2024 02:15
-
-
Save marttp/c836a32af7ba0d37a783004d838661a2 to your computer and use it in GitHub Desktop.
workflow for deploying Leptos to Cloudflare Pages
This file contains hidden or 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: Release to Cloudflare Page | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
cloudflare-pages-release: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install nightly Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: clippy, rustfmt | |
- name: Add WASM target | |
run: rustup target add wasm32-unknown-unknown | |
- name: lint | |
run: cargo clippy & cargo fmt | |
- name: Download and install Trunk binary | |
run: wget -qO- https://github.com/trunk-rs/trunk/releases/download/v0.20.3/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf- | |
- name: Build with Trunk | |
run: ./trunk build --release | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }} | |
directory: './dist' | |
# Optional: Enable this if you want to have GitHub Deployments triggered | |
gitHubToken: ${{ secrets.GH_TOKEN }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment