Skip to content

update github actions #42

update github actions

update github actions #42

Workflow file for this run

name: Deploy
on:
workflow_dispatch:
push:
paths:
- "website/**.[tj]sx?"
- "website/**.css"
- "website/**.md"
- "website/package.json"
- "website/pnpm-lock.yaml"
- "website/tsconfig.json"
- ".github/workflows/deploy.yml"
branches:
- main
pull_request:
paths:
- "website/**.[tj]sx?"
- "website/**.css"
- "website/**.md"
- "website/package.json"
- "website/pnpm-lock.yaml"
- "website/tsconfig.json"
- ".github/workflows/deploy.yml"
branches:
- main
defaults:
run:
shell: bash
working-directory: website
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: website/pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Set up eslint and tsbuildinfo cache
uses: actions/cache@v4
with:
path: |
website/.eslintcache
website/tsconfig.tsbuildinfo
key: static-analysis-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
static-analysis-${{ runner.os }}
- name: Run linting & type checking
run: |
yarn typecheck
yarn lint-ci
- name: Set up next build cache
uses: actions/cache@v4
with:
path: website/.next
key: next-build-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
next-build-${{ runner.os }}
- name: Run build
env:
NEXT_TELEMETRY_DISABLED: 1
run: |
pnpm run build
pnpm run export
- name: Set up npx cache
uses: actions/cache@v4
with:
path: ~/.npm/_npx
key: npx-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
npx-${{ runner.os }}
- name: Deploy to cloudflare pages
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: |
npx wrangler@3 pages deploy ./out --project-name=aleksac-me --branch ${{ github.head_ref || github.ref_name }}
# This is needed by lighthouse ci to run on previews on branches other than
# the default branch. This info needs to be obtained this way because actions
# triggered by `worflow_run` run against the default branch
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: Save branch name
run: |
mkdir -p ./branch-name
echo -n $GITHUB_REF_NAME > ./branch-name/branch-name
- uses: actions/upload-artifact@v4
with:
name: branch-name
path: website/branch-name/