Skip to content

add assets in cd workflow (#8) #36

add assets in cd workflow (#8)

add assets in cd workflow (#8) #36

Workflow file for this run

name: Deploy to Cloudflare Pages
on:
push:
branches: [ main ]
pull_request:
jobs:
deploy:
name: Deploy to Cloudflare Pages
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Gleam
uses: erlef/setup-beam@v1
with:
otp-version: "26.0"
gleam-version: "1.4.0"
rebar3-version: "3"
elixir-version: "1.15"
- name: Install dependencies
run: gleam deps download
- name: Build app
run: gleam run -m lustre/dev build app --minify
- name: Copy output to dist
run: |
mkdir -p dist
cp index.html dist/index.html
cp -r priv dist/priv
ls -R dist/priv
- name: Update path in index.html to use minified app
run: sed -i 's|priv/static/linktri.mjs|priv/static/linktri.min.mjs|' dist/index.html
- name: Deploy with Wrangler
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name ${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME }}