-
Notifications
You must be signed in to change notification settings - Fork 42
71 lines (59 loc) · 2.16 KB
/
pr-deploy-and-comment.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
name: pr-deploy-and-comment
concurrency:
group: pullrequest-untrusted-deploy-${{ github.event.number }}
cancel-in-progress: true
on:
pull_request_target:
branches: [ main ]
types: [ labeled, synchronize ]
jobs:
pr-deploy-and-comment:
if: ${{ contains(github.event.*.labels.*.name, 'safe to build') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true # fetch hugo themes
- uses: actions/setup-go@v5
with:
go-version: '>=1.17.0'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.128.2"
extended: true
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
with:
path: resources
key: ${{ steps.get-date.outputs.date }}-hugo-resources
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ steps.get-date.outputs.date }}-hugo-node_modules
- name: Temp config
run: |
echo url_latest_version = \"https://docs-test.viam.dev/${{ github.event.number }}\" > config_pr.toml
echo baseURL = \"https://docs-test.viam.dev/${{ github.event.number }}\" >> config_pr.toml
- name: Build
run: make build-pr-no-clean
- name: Authenticate on GCS
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI'
run: 'gsutil -m rsync -R -d -c public gs://docs-test.viam.dev/${{ github.event.number }}/'
- name: Comment on PR with link to rendered site
uses: marocchino/[email protected]
with:
recreate: true
message: 'You can view a rendered version of the docs from this PR at https://docs-test.viam.dev/${{ github.event.number }}'
GITHUB_TOKEN: ${{ secrets.PR_TOKEN }}