Skip to content

fix: prepend all tutorial image paths with the repo's slug because nu… #140

fix: prepend all tutorial image paths with the repo's slug because nu…

fix: prepend all tutorial image paths with the repo's slug because nu… #140

Workflow file for this run

name: CI
on:
push:
branches:
- "**"
release:
types: [published]
workflow_dispatch:
permissions:
packages: write
pull-requests: write
contents: write
issues: write
id-token: write
pages: write
jobs:
build-site:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./site
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Setup Node
uses: actions/setup-node@v4.0.1
with:
node-version: 18
cache: npm
cache-dependency-path: ./site
- name: Install dependencies
run: npm ci
- name: Build Site
env:
NUXT_APP_BASE_URL: ${{ vars.NUXT_APP_BASE_URL }}
shell: bash
run: |
env
prefix=${{ env.NUXT_APP_BASE_URL }}
prefix="${prefix%/}"
jq --arg prefix "$prefix" '. | map({image: ($prefix + .image), description: .description})' assets/tutorial.json > tmp.$$.json && mv tmp.$$.json assets/tutorial.json
cat assets/tutorial.json
npx nuxt build --preset github_pages
- name: Upload to Github Actions Artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: site
path: ./site/.output/public
build-esp32:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- uses: actions/cache@v4.0.2
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio-esp32-cyd
- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v4.0.1
with:
node-version: 18
cache: pnpm
- name: Install pnpm dependencies
run: pnpm install
- name: Setup Python
uses: actions/setup-python@v5.0.0
with:
python-version: "3.9"
- name: Install PlatformIO and ESPTool
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio esptool
# TODO: run linter
# TODO: run tests
- name: Build
run: pio run
- name: Create single ESP32 firmware file
run: ./scripts/merge-esp32-firmware.sh
shell: bash
- name: Upload ESP32 firmware to Github Actions Artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: esp32
path: ./out
- name: Run Semantic Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
deploy-site:
runs-on: ubuntu-latest
needs: [build-site, build-esp32]
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.1
- name: Download Site Artifact
uses: actions/download-artifact@v4.1.7
with:
name: site
path: ./site/.output/public
- name: Download ESP32 Artifact
uses: actions/download-artifact@v4.1.7
with:
name: esp32
path: ./out
- name: Prepare Site Assets
env:
NUXT_APP_BASE_URL: ${{ vars.NUXT_APP_BASE_URL }}
shell: bash
run: |
mkdir -p ./_site
cp -r ./site/.output/public/* ./_site
cp -r ./out/* ./_site
ls ./_site
tag_name="${{ github.event.release.tag_name }}"
manifest_file_path="./_site/manifest.json"
jq --arg version "$tag_name" --arg prefix "${{ env.NUXT_APP_BASE_URL }}" '
.version = $version |
.builds[].parts[].path |= ($prefix + .)
' "$manifest_file_path" > tmp.$$.json && mv tmp.$$.json "$manifest_file_path"
cat $manifest_file_path
- name: Upload Site Assets Github Pages
uses: actions/upload-pages-artifact@v3.0.1
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4.0.5