start date per habit #12
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 and Deploy Web Version | |
on: | |
push: | |
branches: [ axis ] | |
pull_request: | |
branches: [ axis ] | |
env: | |
EM_VERSION: '3.1.74' # Specify the Emscripten version | |
EM_CACHE_FOLDER: 'emsdk-cache' # Folder to cache Emscripten SDK and system libraries | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
# Step 2: Set up Nix | |
- name: Install Nix | |
uses: cachix/install-nix-action@v24 | |
with: | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
# Step 3: Set up Emscripten with caching | |
- name: Cache Emscripten SDK and system libraries | |
id: cache-emsdk | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.EM_CACHE_FOLDER }} | |
key: emsdk-${{ env.EM_VERSION }}-${{ runner.os }}-${{ hashFiles('**/xmake.lua') }} | |
restore-keys: | | |
emsdk-${{ env.EM_VERSION }}-${{ runner.os }}- | |
emsdk-${{ env.EM_VERSION }}- | |
- name: Set up Emscripten | |
uses: mymindstorm/setup-emsdk@v14 | |
with: | |
version: ${{ env.EM_VERSION }} | |
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }} | |
- name: Configure Nix channels and install xmake | |
run: | | |
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs | |
nix-channel --update | |
nix-env -iA nixpkgs.xmake | |
# Step 5: Build for Web (WASM) | |
- name: Build for Web (WASM) | |
run: | | |
xmake f -p wasm -y | |
xmake -y | |
# Step 6: Prepare artifacts | |
- name: Prepare artifacts | |
run: | | |
mkdir -p netlify-build | |
cp -r build/clay/* netlify-build/ | |
cp index.html netlify-build/ | |
cp manifest.json netlify-build/ | |
cp -r fonts netlify-build/ | |
cp -r images netlify-build/ | |
cp -r scripts netlify-build/ | |
# Step 7: Deploy to Netlify | |
- name: Deploy to Netlify | |
uses: nwtgck/actions-netlify@v2 | |
with: | |
publish-dir: './netlify-build' | |
production-deploy: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |