-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (67 loc) · 2.47 KB
/
build_pull_request.yaml
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
# This is a basic workflow takes care of building and deploying
# catalog when creating merge request to main branch
# Workflow for deploying content to bucket
name: Deploy test static content to s3 bucket
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- 'main'
concurrency: preview-${{ github.ref }}
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: |
pip install -U pip
pip install eodash_catalog==0.1.0
- if: github.event.pull_request.body == ''
name: Build all - no items
env:
SH_INSTANCE_ID: ${{ secrets.SH_INSTANCE_ID }}
SH_CLIENT_ID: ${{ secrets.SH_CLIENT_ID }}
SH_CLIENT_SECRET: ${{ secrets.SH_CLIENT_SECRET }}
run: |
eodash_catalog -ni
- if: github.event.pull_request.body == 'all'
name: Build all
env:
SH_INSTANCE_ID: ${{ secrets.SH_INSTANCE_ID }}
SH_CLIENT_ID: ${{ secrets.SH_CLIENT_ID }}
SH_CLIENT_SECRET: ${{ secrets.SH_CLIENT_SECRET }}
run: eodash_catalog
- if: github.event.pull_request.body != 'all' && github.event.pull_request.body != ''
name: Build only specified collections
env:
SH_INSTANCE_ID: ${{ secrets.SH_INSTANCE_ID }}
SH_CLIENT_ID: ${{ secrets.SH_CLIENT_ID }}
SH_CLIENT_SECRET: ${{ secrets.SH_CLIENT_SECRET }}
run: |
eodash_catalog ${{ github.event.pull_request.body }}
# Upload build to S3
- name: sync client s3
uses: jakejarvis/[email protected]
env:
SOURCE_DIR: 'build'
DEST_DIR: 'catalog/${{ github.event.pull_request.head.ref }}'
AWS_REGION: 'eu-central-1'
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Invalidate Cloudfront
- name: invalidate
uses: chetan/[email protected]
env:
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
PATHS: '/${{ github.event.pull_request.head.ref }}/*'
AWS_REGION: 'eu-central-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}