-
Notifications
You must be signed in to change notification settings - Fork 92
72 lines (62 loc) · 2.36 KB
/
firebase-hosting-pull-request.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
name: Deploy website to preview channel on PR
'on': pull_request
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Check out repository code
uses: actions/checkout@v2
- name: Add reference docs to website
run: |
cd website/static
gsutil cp gs://opencascade-js/reference-docs.zip .
unzip reference-docs.zip
rm reference-docs.zip
- name: Add starter templates to website
run: |
cd website/static
mkdir download-starter-templates
gsutil cp -r gs://opencascade-js/starter-templates ./download-starter-templates
mv download-starter-templates/starter-templates/* download-starter-templates/
rm -r download-starter-templates/starter-templates
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]
- name: Generate Docker Staging Tag Name
id: dockerStagingTag
run: |
githubBranch=${{ steps.branch-name.outputs.current_branch }}
tag=$(echo "$githubBranch" | tr '[:upper:]' '[:lower:]')
echo "::set-output name=tag::$tag"
- name: Create custom build
run: |
cd website/ocjs-editor-theme/src/customBuild
docker run --rm \
-v $(pwd):/src \
-u $(id -u):$(id -g) \
${{ secrets.DOCKER_IMAGE_NAME }}:staging-${{ steps.dockerStagingTag.outputs.tag }} \
/src/customBuild.yml
- name: Build website
run: |
cd website
npm ci
cd ocjs-editor-theme
npm ci && npm run build
cd ..
npm run build
npm run disallow-search-bots
- name: Deploy to firebase preview channel
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_OPENCASCADE_JS }}'
projectId: opencascade-js
entryPoint: website
expires: 30d