-
Notifications
You must be signed in to change notification settings - Fork 626
56 lines (45 loc) · 1.47 KB
/
deploy-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
name: Deploy
on:
push:
branches:
- "main"
paths:
- "docs/**"
- "website/**"
- ".github/workflows/deploy-website.yml"
permissions:
contents: read
jobs:
deploy:
permissions:
contents: write # to deploy
runs-on: ubuntu-latest
if: github.repository == 'facebook/metro'
env:
working-directory: website
node-version: 16.x
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Use Node.js ${{ env.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ env.node-version }}
- name: Get yarn cache directory
id: yarn
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore yarn cache
uses: actions/[email protected]
with:
path: ${{ steps.yarn.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/website/yarn.lock')) }}
- name: Install packages
working-directory: ${{ env.working-directory }}
run: yarn --frozen-lockfile
- name: Deploy to GitHub Pages
working-directory: ${{ env.working-directory }}
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
echo "machine github.com login ${GITHUB_ACTOR} password ${{ secrets.GITHUB_TOKEN }}" > ~/.netrc
GIT_USER=${GITHUB_ACTOR} yarn deploy