-
Notifications
You must be signed in to change notification settings - Fork 167
122 lines (121 loc) · 4.24 KB
/
website.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Website
on:
push:
branches:
- main
paths:
- 'packages/website/**'
- '.github/workflows/website.yml'
- 'yarn.lock'
pull_request:
paths:
- 'packages/website/**'
- '.github/workflows/website.yml'
- 'yarn.lock'
jobs:
check:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- uses: bahmutov/npm-install@v1
- name: Run build
env:
# Fake environment vars required for build
NEXT_PUBLIC_SENTRY_DSN: 'https://000000@0000000.ingest.sentry.io/00000'
NEXT_PUBLIC_ENV: dev
run: yarn build:website
- name: Run test
run: yarn test:website
test-e2e:
name: ${{ matrix.os }} (${{ matrix.browser }})
strategy:
fail-fast: false
matrix:
browser:
- firefox
- chromium
os:
- ubuntu-20.04
node-version:
- '16'
test_results_path:
# corresponds to playwright invocation/configuration
- packages/website/test-results
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- uses: bahmutov/npm-install@v1
env:
DEBUG: pw:install
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
working-directory: packages/website
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace website run test:e2e -- --project=${{ matrix.browser }}
- name: Check for website test results
id: check_website_test_results
uses: andstor/file-existence-action@v1
with:
files: ${{ matrix.test_results_path }}
- if: steps.check_website_test_results.outputs.files_exists == 'true'
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.browser }}-${{ matrix.os }}-test-results
path: ${{ matrix.test_results_path }}
changelog:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
name: Changelog
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.tag-release.outputs.releases_created }}
steps:
- uses: GoogleCloudPlatform/release-please-action@v3
id: tag-release
with:
path: packages/website
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
monorepo-tags: true
package-name: website
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Other Changes","hidden":false}]'
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changelog.outputs.releases_created
name: Release
runs-on: ubuntu-latest
needs:
- check
- test-e2e
- changelog
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
registry-url: https://registry.npmjs.org/
- uses: bahmutov/npm-install@v1
- name: Run build
env:
NEXT_PUBLIC_MAGIC: ${{ secrets.NEXT_PUBLIC_MAGIC }}
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN }}
NEXT_PUBLIC_COUNTLY_KEY: ${{ secrets.NEXT_PUBLIC_COUNTLY_KEY }}
NEXT_PUBLIC_COUNTLY_URL: ${{ secrets.NEXT_PUBLIC_COUNTLY_URL }}
NEXT_PUBLIC_ENV: production
NEXT_PUBLIC_API: https://api.nft.storage
NEXT_PUBLIC_NFT_PORT_API_KEY: ${{ secrets.NEXT_PUBLIC_NFT_PORT_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
SENTRY_ORG: protocol-labs-it
SENTRY_PROJECT: frontend
SENTRY_URL: https://sentry.io/
NEXT_PUBLIC_BLOG_URL: https://blog.nft.storage
run: yarn build:website
- name: Website - Deploy
run: npx wrangler pages publish --project-name nft-storage --branch main ./packages/website/out
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT }}