-
Notifications
You must be signed in to change notification settings - Fork 19
123 lines (109 loc) · 3.49 KB
/
main.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
123
on:
push:
branches:
- main
pull_request:
release:
types:
- created
name: build-deploy
jobs:
build:
runs-on: ubuntu-latest
outputs:
public_url: ${{ steps.install.outputs.public_url }}
public_path: ${{ steps.install.outputs.public_path }}
steps:
- uses: actions/checkout@master
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: npm
- name: set package.json version
uses: menduz/oddish-action@master
with:
deterministic-snapshot: true
only-update-versions: true
- id: install
name: install
run: npm ci
- name: build
run: npm run build
- name: test
run: npm run test
- name: publish npm package
uses: menduz/oddish-action@master
with:
registry-url: "https://registry.npmjs.org"
access: public
cwd: ./build
## use action runId instead of current date to generate snapshot numbers
deterministic-snapshot: true
## inform gitlab after publishing to proceed with CDN propagation
gitlab-token: ${{ secrets.GITLAB_TOKEN }}
gitlab-pipeline-url: ${{ secrets.GITLAB_URL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: deploy preview
env:
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
EXPLORER_WEB_BUCKET: ${{ secrets.EXPLORER_WEB_BUCKET }}
if: ${{ steps.install.outputs.public_path }}
run: |
npx @dcl/cdn-uploader@next \
--bucket $EXPLORER_WEB_BUCKET \
--local-folder build \
--bucket-folder "${{ steps.install.outputs.public_path }}"
build-static:
runs-on: ubuntu-latest
outputs:
public_url: ${{ steps.install.outputs.public_url }}
public_path: ${{ steps.install.outputs.public_path }}
steps:
- uses: actions/checkout@master
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: npm
- id: install
name: install
run: npm ci
env:
GEN_STATIC_LOCAL: true
- name: build for deployment
run: npm run build:full
env:
GEN_STATIC_LOCAL: true
- uses: actions/upload-artifact@v2
with:
name: static-site-build
path: build
if-no-files-found: error
notify_deployment:
needs: [build]
if: ${{ github.event.pull_request.number }}
runs-on: ubuntu-latest
name: Deployment Notification
steps:
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Test this pull request
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
# Test this pull request
This branch can be previewed at
- [`stable` explorer](${{ needs.build.outputs.public_url }}/)
- [`development` explorer](${{ needs.build.outputs.public_url }}/?explorer-branch=dev)
edit-mode: replace