-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (58 loc) · 2.17 KB
/
preview.yml
File metadata and controls
60 lines (58 loc) · 2.17 KB
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
# .github/workflows/preview.yml
# This is a basic workflow takes care of building and deploying
# catalog when creating merge request
name: Deploy PR previews
on:
pull_request_target:
branches:
- main
types:
- opened
- reopened
- synchronize
- closed
# do not allow running multiple of pipelines for this PR in parallel
concurrency: preview-${{ github.ref }}
jobs:
deploy-preview:
runs-on: ubuntu-22.04
permissions:
contents: write
pages: write
pull-requests: write
packages: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
-
if: github.event.action != 'closed' # skip the build if the PR has been closed, just for cleanup
name: changed-files
id: changed-files
uses: tj-actions/changed-files@v45
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g
# with:
# since_last_remote_commit: true
-
if: github.event.action != 'closed' # skip the build if the PR has been closed, just for cleanup
name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: python .github/update_catalog.py
-
if: github.event.action != 'closed' # skip the build if the PR has been closed, just for cleanup
name: Build
env:
SH_INSTANCE_ID: ${{ secrets.SH_INSTANCE_ID }}
SH_CLIENT_ID: ${{ secrets.SH_CLIENT_ID }}
SH_CLIENT_SECRET: ${{ secrets.SH_CLIENT_SECRET }}
run: |
docker pull ghcr.io/eodash/eodash_catalog:latest
docker run -v "$PWD:/workspace" -w "/workspace" -e SH_INSTANCE_ID="$SH_INSTANCE_ID" -e SH_CLIENT_ID="$SH_CLIENT_ID" -e SH_CLIENT_SECRET="$SH_CLIENT_SECRET" ghcr.io/eodash/eodash_catalog:latest eodash_catalog
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build