Skip to content

Update GitHub Actions workflow for better static asset handling #11

Update GitHub Actions workflow for better static asset handling

Update GitHub Actions workflow for better static asset handling #11

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.15.7'
otp-version: '26.2.1'
- name: Restore dependencies
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Build assets
run: |
# Create necessary directories
mkdir -p priv/static/images
mkdir -p priv/static/assets
# Copy static assets
cp -r priv/static/images/* priv/static/images/ 2>/dev/null || true
cp -r assets/static/* priv/static/ 2>/dev/null || true
# Build and digest assets
mix assets.deploy
mix phx.digest
# Ensure CNAME is present
echo "katibestdesign.com" > priv/static/CNAME
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./priv/static
force_orphan: true