Skip to content

chore(CI): change way to set URLs of Lighthouse CI #16

chore(CI): change way to set URLs of Lighthouse CI

chore(CI): change way to set URLs of Lighthouse CI #16

Workflow file for this run

name: CI
on:
push:
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.21.x
- uses: actions/checkout@v3
- run: cd builder && go test -race ./...
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.21.x
- name: Checkout base branch
uses: actions/checkout@v3
- name: Checkout photos branch
uses: actions/checkout@v3
with:
ref: photos
path: pages/photos
- name: Build pages
run: make build
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
lighthouse:
name: Lighthouse Test
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Load artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: treosh/lighthouse-ci-action@v10
with:
configPath: .github/lighthouse.json
urls: |
/index.html
/blog/index.html
/blog/2020/05/blanktar-renewal/index.html
/blog/2023/08/golang-goldmark-custom-renderer/index.html
/works/index.html
/photos/index.html
uploadArtifacts: true
preview:
name: Preview Deploy
runs-on: ubuntu-latest
needs: [test, build]
if: ${{github.ref != 'refs/heads/master' && github.ref != 'refs/hedas/photos'}}
environment:
name: preview
url: ${{ steps.deploy.outputs.url }}
steps:
- name: Instal Vercel CLI
run: npm install --global vercel@latest
- name: Checkout repository
uses: actions/checkout@v3
- name: Load artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Pull Vercel environment information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel
id: deploy
run: |
echo -n "url=" >> $GITHUB_OUTPUT
vercel deploy --token=${{ secrets.VERCEL_TOKEN }} >> $GITHUB_OUTPUT
production:
name: Production Deploy
runs-on: ubuntu-latest
needs: [test, lighthouse, build]
if: ${{github.ref == 'refs/heads/master' || github.ref == 'refs/hedas/photos'}}
environment:
name: production
url: ${{ steps.deploy.outputs.url }}
steps:
- name: Instal Vercel CLI
run: npm install --global vercel@latest
- name: Checkout repository
uses: actions/checkout@v3
- name: Load artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Pull Vercel environment information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel
id: deploy
run: |
echo -n "url=" >> $GITHUB_OUTPUT
vercel deploy --token=${{ secrets.VERCEL_TOKEN }} --prod >> $GITHUB_OUTPUT