mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 04:38:28 -04:00
https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
# "[skip ci]" also causes Netlify to skip, so these are automatically in harmony
|
|
# https://docs.netlify.com/site-deploys/manage-deploys/#skip-a-deploy
|
|
if: "github.actor == 'jakejarvis' && !contains(github.event.head_commit.message, '[skip ci]')"
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Wait for Netlify
|
|
# installing via `npx` each run takes a long time, but deploys always take longer
|
|
run: npx netlify-cli watch
|
|
env:
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
|
|
audit:
|
|
runs-on: ubuntu-latest
|
|
needs: deploy
|
|
env:
|
|
LHCI_TOKEN: ${{ secrets.LHCI_TOKEN }}
|
|
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 2
|
|
lfs: false
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: 14.x
|
|
- name: Install LHCI
|
|
run: npm install -g @lhci/cli
|
|
- name: Check LHCI
|
|
run: |
|
|
lhci --version
|
|
lhci healthcheck
|
|
- name: Audit deploy preview
|
|
if: "github.event_name == 'pull_request'"
|
|
continue-on-error: true
|
|
run: |
|
|
lhci autorun \
|
|
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.app/ \
|
|
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.app/notes/netlify-analytics-review/ \
|
|
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.app/notes/how-to-pull-request-fork-github/amp.html
|
|
- name: Audit production site
|
|
if: "github.event_name == 'push' && github.ref == 'refs/heads/main'"
|
|
continue-on-error: true
|
|
run: |
|
|
lhci autorun \
|
|
--collect.url=https://jarv.is/ \
|
|
--collect.url=https://jarv.is/notes/netlify-analytics-review/ \
|
|
--collect.url=https://jarv.is/notes/how-to-pull-request-fork-github/amp.html
|
|
- name: Upload results as artifact
|
|
uses: actions/upload-artifact@v2
|
|
if: success()
|
|
with:
|
|
name: lhci-results
|
|
path: ./.lighthouseci
|