-
Notifications
You must be signed in to change notification settings - Fork 68
63 lines (57 loc) · 1.91 KB
/
preview.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
name: Deploy PR previews
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy-preview:
runs-on: ubuntu-20.04
env:
COMMIT_AUTHOR: Deploy Action
COMMIT_AUTHOR_EMAIL: action@github.com
steps:
- uses: actions/checkout@v2
- run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install prerequisites
run: pip install --upgrade wheel setuptools
- name: Install
run: pip install -e . -v
- name: Get cloned data from gh-pages
run: |
git remote set-url origin https://github.com/aiidateam/aiida-registry.git
git fetch origin gh-pages
git checkout origin/gh-pages plugins_metadata.json || true
- name: Move JSON file to the React project
run: |
mv plugins_metadata.json aiida-registry-app/src/
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install npm dependencies and build
run: |
npm install
export VITE_PR_PREVIEW_PATH="/aiida-registry/pr-preview/pr-${{ github.event.number }}/"
npm run build
working-directory: ./aiida-registry-app
- name: Add plugins_metadata.json to the build folder
run: cp ./aiida-registry-app/src/plugins_metadata.json ./aiida-registry-app/dist
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./aiida-registry-app/dist
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
custom-url: