Skip to content

📈 Add self hosted analytics #25

📈 Add self hosted analytics

📈 Add self hosted analytics #25

Workflow file for this run

name: Deploy CardFoldr to GitHub Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Inject version information
run: |
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
jq -n --arg commit "$GITHUB_SHA" --arg build "$GITHUB_RUN_NUMBER" --arg date "$DATE" '{commit: $commit, build: $build, date: $date}' > ./src/version.json
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./src
# Test job
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 🏗 Prepare Playwright env
working-directory: ./tests
run: |
npm ci
PLAYWRIGHT_VERSION=$(npm ls --json @playwright/test | jq --raw-output '.dependencies["@playwright/test"].version')
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: 🧰 Cache Playwright browser binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: "~/.cache/ms-playwright"
key: "${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}"
restore-keys: |
${{ runner.os }}-playwright-
- name: 🏗 Install Playwright browser binaries & OS dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: ./tests
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
npx playwright install --with-deps
- name: 🏗 Install Playwright OS dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
working-directory: ./tests
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
npx playwright install-deps
- name: 🏗 Install extra PDF compare dependencies
run: |
sudo apt-get update
sudo apt-get install graphicsmagick
sudo apt-get install imagemagick
sudo apt-get install ghostscript
# Change ImageMagick policy to allow pdf -> png conversion
sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
- name: 🎭 Run Playwright
working-directory: ./tests
run: |
npx playwright test
- name: ⬆ Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: tests/playwright-report
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs:
- build
- test
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4