-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (98 loc) · 3.82 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Run CI Suite
on:
push:
branches:
- main
pull_request:
branches:
- main
# Cancel this run if a newer commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
percy-instructions:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Comment with percy instructions
uses: bubkoo/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pullRequestOpened: >
# Percy Screenshots
In order to conserve our percy screenshot allowance, percy is not configured to run automatically. Please make sure the PR is ready and all other checks are passing, then start it manually:
1. Visit https://github.com/UCLALibrary/ucla-library-website-components/actions/workflows/percy.yml
2. Click the 'Run workflow' button in the blue bar.
3. Select the correct branch for this PR and click 'Run workflow' again to confirm.
eslint:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.PAT_SEMENTIC_RELEASE_AND_ESLINT }} # non-github token Parinita's personal access token will expire ever 90 days
- uses: ./.github/workflows/setup-workspace
- run: pnpm run lint
- uses: EndBug/add-and-commit@v9
with:
message: "chore: linter autofixes"
default_author: github_actions
vite:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup-workspace
- run: pnpm run build
storybook:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup-workspace
- name: Cache Storybook Build
id: cache-storybook
uses: actions/cache@v3
with:
path: storybook-static
key: storybook-${{ github.sha }}
- run: pnpm run build-storybook
- name: Deploy to Netlify (merged)
if: github.ref_name == 'main' || github.ref_name == 'vue3.x'
uses: nwtgck/actions-netlify@v2 # v1.2.3
with:
production-deploy: true
deploy-message: https://github.com/UCLALibrary/ucla-library-website-component/commit/${{ github.sha }}
github-token: ${{ secrets.GITHUB_TOKEN }}
publish-dir: './storybook-static'
fails-without-credentials: true
github-deployment-environment: test
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_STORYBOOK_VUE3X }}
- name: Deploy to Netlify (preview)
if: github.event_name == 'pull_request'
uses: nwtgck/actions-netlify@v2 # v1.2.3
with:
production-deploy: false
deploy-message: https://github.com/UCLALibrary/ucla-library-website-component/pull/${{ github.event.pull_request.number }}
alias: deploy-preview-${{ github.event.pull_request.number }}
github-token: ${{ secrets.GITHUB_TOKEN }}
overwrites-pull-request-comment: true
publish-dir: './storybook-static'
fails-without-credentials: true
github-deployment-environment: storybook--${{ github.event_name }}-${{ github.event.number }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_STORYBOOK_VUE3X }}
- name: Cypress test for Storybook Components
uses: cypress-io/github-action@v5
with:
start: pnpm dlx http-server ./storybook-static -p 6006
wait-on: http://localhost:6006
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_STORYBOOK_VUE3X }}