forked from nodejs/nodejs.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.58 KB
/
upload-to-staging.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
name: Upload to staging
on:
issue_comment:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
if: github.event.issue.pull_request != null && github.event.comment.body == '/preview'
steps:
- uses: actions/checkout@v2
- name: Checkout Git Branch
run: |
git fetch origin +refs/pull/${{ github.event.issue.number }}/merge
git checkout FETCH_HEAD
- name: Setup GCloud
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Install Dependencies
run: npm ci
- name: Run Gatsby Build
run: npm run build-ci
env:
PATH_PREFIX: ${{ github.event.issue.number }}/
- name: Run Storybook Build
run: npm run build-storybook
env:
PATH_PREFIX: ${{ github.event.issue.number }}/
- name: Upload to GCS
run: gsutil -m rsync -R public gs://staging.nodejs.dev/${{ github.event.issue.number }}/
- name: Comment on PR
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Please find a preview at: https://staging.nodejs.dev/${{ github.event.issue.number }}/'
});