-
Notifications
You must be signed in to change notification settings - Fork 36
64 lines (57 loc) · 1.91 KB
/
deploy.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
name: Publish to GitHub pages
on:
workflow_call:
inputs:
cache_sha:
type: string
required: true
folder:
type: string
required: true
jobs:
deploy-to-pages:
name: Deploy gh-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get dist files
uses: actions/cache@v3
with:
path: packages/geoview-core/dist
key: dist-${{ inputs.cache_sha }}
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: packages/geoview-core/dist
target-folder: ${{inputs.folder}}
single-commit: true
- uses: actions/github-script@v6
name: Post link to demo for PR's
if: github.event_name == 'pull_request_target' && github.event.action == 'opened'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Your demo site is ready! 🚀 Visit it here: https://${{github.repository_owner}}.github.io/geoview/${{inputs.folder}}`
})
cleanup-pages:
name: Cleanup gh-pages
runs-on: ubuntu-latest
steps:
## Delete the PR demo from gh-pages when the PR is closed
- uses: actions/checkout@v3
with:
ref: 'gh-pages'
- name: Delete the files
if: github.event_name == 'pull_request_target' && github.event.action == 'closed'
continue-on-error: true
shell: bash
run: |
git config --global user.email "[email protected]"
git config --global user.name "Johann Levesque"
git rm -r ${{ github.head_ref }}/*
git commit -a -m 'Delete PR demo ${{ github.head_ref }}'
git push origin HEAD:gh-pages