This repository was archived by the owner on Apr 13, 2021. It is now read-only.
Repository navigation
121 lines (119 loc) · 5.17 KB
/
Copy pathweb.yaml
File metadata and controls
121 lines (119 loc) · 5.17 KB
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
name: website
on:
pull_request:
types: [opened,edited,synchronize,reopened]
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: sparse checkout
shell: bash
run: |
# https://github.com/actions/checkout/issues/172#issuecomment-597265972
# https://qiita.com/y-icchi/items/1bddd58872f9624ba2eb
REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
BRANCH="${GITHUB_REF/#refs\/heads\//}"
# Following code is based on logs of actions/checkout@v, with sparseCheckout stuff inserted in the middle
echo "Syncing repository: $GITHUB_REPOSITORY"
echo "Working directory is '$(pwd)' GITHUB_WORKSPACE=$GITHUB_WORKSPACE BRANCH=$BRANCH"
git version
git init $GITHUB_WORKSPACE
git remote add origin https://github.com/$GITHUB_REPOSITORY
git config --local gc.auto 0
# Now interesting part
git config core.sparseCheckout true
git config filter.lfs.smudge "git-lfs smudge --skip %f"
# Add here contents of sparse-checkout line by line
echo /packages/domains/meta > .git/info/sparse-checkout
echo /packages/protocol/command-schema-core >> .git/info/sparse-checkout
echo /packages/protocol/command-schema-main >> .git/info/sparse-checkout
echo /packages/protocol/command-schema-core-bootstrap >> .git/info/sparse-checkout
echo /packages/protocol/command-schema-main-bootstrap >> .git/info/sparse-checkout
echo /packages/util/@guild-utils/command-schema >> .git/info/sparse-checkout
echo /packages/util/@guild-utils/command-types >> .git/info/sparse-checkout
echo /packages/util/@guild-utils/command-types-discord.js >> .git/info/sparse-checkout
echo /packages/util/@guild-utils/command-parser >> .git/info/sparse-checkout
echo /packages/util/@guild-utils/command-base >> .git/info/sparse-checkout
echo /packages/languages/command-core >> .git/info/sparse-checkout
echo /packages/languages/command-main >> .git/info/sparse-checkout
echo /packages/presentation/web >> .git/info/sparse-checkout
echo /package.json >> .git/info/sparse-checkout
echo /yarn.lock >> .git/info/sparse-checkout
echo /lerna.json >> .git/info/sparse-checkout
echo /tsconfig.json >> .git/info/sparse-checkout
echo /.eslintrc.json >> .git/info/sparse-checkout
git pull --depth=1 origin master
git lfs pull -I packages/presentation/web/public/main-icon.webp,packages/presentation/web/public/sub1-icon.webp,packages/presentation/web/public/sub2-icon.webp
pwd;find . | sort | sed '1d;s/^\.//;s/\/\([^/]*\)$/|--\1/;s/\/[^/|]*/| /g'
- name: setup nodejs
uses: actions/setup-node@v1
with:
node-version: '14'
- name: install lerna
run: |
yarn global add lerna
echo "$(yarn global bin)" >> $GITHUB_PATH
- name: bootstrap
run: lerna bootstrap
- name: build static website
run: lerna run build
- name: lint
run: lerna run test:lint
- name: upload static website
uses: actions/upload-artifact@v2
with:
name: static website
path: packages/presentation/web/out
- name: upload git context
uses: actions/upload-artifact@v2
with:
name: git context
path: .git
deploy-stg:
runs-on: ubuntu-latest
needs: [build]
if: ( github.event_name == 'pull_request' && github.base_ref == 'refs/heads/production-web' ) || ( github.event_name == 'push' && github.ref != 'refs/heads/production-web' )
env:
WEB_DEPLOY_TOKEN: ${{ secrets.WEB_DEPLOY_TOKEN }}
steps:
- name: download git context
uses: actions/download-artifact@v2
with:
name: git context
path: .git
- name: download static website
uses: actions/download-artifact@v2
with:
name: static website
- name: deploy-stg
uses: amondnet/vercel-action@v19
with:
github-comment: true
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
github-token: ${{ secrets.GITHUB_TOKEN }} #Optional
vercel-org-id: ${{ secrets.ORG_ID}} #Required
vercel-project-id: ${{ secrets.PROJECT_ID}} #Re
deploy-prod:
runs-on: ubuntu-latest
needs: [build]
if: ( github.event_name == 'push' && github.ref == 'refs/heads/production-web' )
steps:
- name: download git context
uses: actions/download-artifact@v2
with:
name: git context
path: .git
- name: download static website
uses: actions/download-artifact@v2
with:
name: static website
- name: deploy-production
uses: amondnet/vercel-action@v19
with:
github-comment: true
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
github-token: ${{ secrets.GITHUB_TOKEN }} #Optional
vercel-args: '--prod' #Optional
vercel-org-id: ${{ secrets.ORG_ID}} #Required
vercel-project-id: ${{ secrets.PROJECT_ID}} #Required