blob: c4f7f813a64ea7125d5cfbfd338792c610faee83 (
plain)
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
|
name: Test, build and publish UI
on:
push:
branches:
- main
env:
GCS_BUCKET: slam-lang-gh-artifacts
VITE_RUNNER_API_URL: https://runner-api-6hdcd6nxsq-ew.a.run.app
VITE_EXAMPLE_API_URL: https://example-api-6hdcd6nxsq-ew.a.run.app
jobs:
test-build-and-publish:
runs-on: ubuntu-latest
steps:
- id: checkout
uses: actions/checkout@v2
- name: "Compute archive name"
run: |
echo "Long commit SHA: ${GITHUB_SHA}"
export TAG=$(echo "${GITHUB_SHA}" | head -c 7)
export ARCHIVE="ui-${TAG}.zip"
echo "ARCHIVE: ${ARCHIVE}"
echo "TAG=${TAG}" >> ${GITHUB_ENV}
echo "ARCHIVE=${ARCHIVE}" >> ${GITHUB_ENV}
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
- name: "Set up Node.js 16"
uses: actions/setup-node@v2
with:
node-version: "16"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v0"
- name: "Install NPM deps"
run: |
npm ci
npm i serve
- name: "Build"
run: |
npm run build
- name: "Run E2E tests"
run: |
npx -y serve -p 3000 dist &
npm run test
kill %1
- name: "Compress and publish"
run: |
zip -r "${ARCHIVE}" dist
gsutil cp "${ARCHIVE}" gs://${GCS_BUCKET}/
echo "Published revision ${TAG} (archive gs://${GCS_BUCKET}/${ARCHIVE})"
|