This repository was archived by the owner on Feb 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
144 lines (125 loc) · 4.38 KB
/
Copy pathtest-build-deploy.yml
File metadata and controls
144 lines (125 loc) · 4.38 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
on:
push:
branches:
- main
pull_request:
release:
types:
- created
name: test-build-deploy
jobs:
validations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: browser-actions/setup-chrome@latest
- uses: actions/setup-node@v3
with:
node-version: lts/-1
cache: 'npm'
- name: install
run: |
sudo apt-get install xvfb
npm ci
- name: test-ci
run: xvfb-run --auto-servernum make test-ci
- name: lint
run: make lint
# - name: codecov
# run: npx codecov
build:
runs-on: ubuntu-latest
outputs:
dcl_kernel_s3_bucket_key: ${{ steps.publish_dcl_kernel.outputs.s3-bucket-key }}
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Get the current branch name
shell: bash
run: node -e "console.log('::set-output name=branch::' + ('${{github.head_ref}}' || '$GITHUB_REF'.replace('refs/heads/','')) )"
id: myref
- uses: actions/setup-node@v3
with:
node-version: lts/-1
cache: 'npm'
- name: set package.json version
uses: menduz/oddish-action@master
with:
deterministic-snapshot: true
only-update-versions: true
cwd: ./static
- name: install
run: |
npm ci
- name: build
run: make build-essentials build-release build-deploy
- uses: hmarr/debug-action@v2
- name: publish packages
uses: menduz/oddish-action@master
id: publish_dcl_kernel
with:
registry-url: 'https://registry.npmjs.org'
access: public
cwd: ./static
## use action runId instead of current date to generate snapshot numbers
deterministic-snapshot: true
## publish every package to s3
s3-bucket: ${{ secrets.SDK_TEAM_S3_BUCKET }}
s3-bucket-key-prefix: '@dcl/kernel/branch/${{ steps.myref.outputs.branch }}'
## 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 }}
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.SDK_TEAM_AWS_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SDK_TEAM_AWS_SECRET }}
- name: deploy preview
env:
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.SDK_TEAM_AWS_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SDK_TEAM_AWS_SECRET }}
CDN_BUCKET: ${{ secrets.SDK_TEAM_S3_BUCKET }}
run: |
npx @dcl/cdn-uploader@next \
--bucket $CDN_BUCKET \
--local-folder static \
--bucket-folder "@dcl/kernel/branch/${{ steps.myref.outputs.branch }}"
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: Get the current branch name
shell: bash
run: node -e "console.log('::set-output name=branch::' + ('${{github.head_ref}}' || '$GITHUB_REF'.replace('refs/heads/','')) )"
id: myref
- name: Generate S3 URL
id: url-generator
run: |
body=$(echo ${{ secrets.SDK_TEAM_S3_BASE_URL }})/${{ needs.build.outputs.dcl_kernel_s3_bucket_key }}
echo ::set-output name=body::$body
- 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 https://play.decentraland.zone/?kernel-branch=${{ steps.myref.outputs.branch }}
- The `@dcl/kernel` package can be tested in scenes by running
```bash
npm install "${{ steps.url-generator.outputs.body }}"
```
edit-mode: replace