-
Notifications
You must be signed in to change notification settings - Fork 34
76 lines (67 loc) · 2.44 KB
/
main.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
72
73
74
75
76
name: Deploy process on Pull Request
on:
pull_request_target:
types: [opened, synchronize, closed]
push:
branches:
- 'develop'
# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
check-member:
name: Check if we continue the process
runs-on: ubuntu-latest
steps:
- name: Echo PR info
env:
ACTOR: ${{ github.actor }}
ACTION: ${{ github.event.action }}
MERGE: ${{ github.event.pull_request.merged }}
HEAD: ${{ github.head_ref }}
run: |
echo User $ACTOR is about to $ACTION this Pull Request.
echo The PR is merged: $MERGE.
echo The PR head reference: $HEAD.
- name: Check if contributor is an org member
id: is_organization_member
if: github.event_name == 'pull_request_target'
uses: JamesSingleton/[email protected]
with:
organization: Canadian-Geospatial-Platform
username: ${{ github.event.pull_request.head.user.login }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Output comment and end build if not org member
if: github.event_name == 'pull_request_target'
run: |
result=${{ steps.is_organization_member.outputs.result }}
if [ $result == false ]; then
user=${{ github.event.pull_request.head.user.login }}
echo Either ${user} is not part of the Canadian-Geospatial-Platform organization
echo or ${user} has its Organization Visibility set to Private at
echo https://github.com/orgs/Canadian-Geospatial-Platform/people?query=${user}
exit 1
fi
install-build:
name: Build demo files
needs: [check-member]
uses: ./.github/workflows/build.yml
with:
cache_sha: ${{ github.event.pull_request.head.sha || github.sha }}
deploy-pr:
name: Deploy pr
needs: [install-build]
if: github.event.pull_request.merged == false && github.head_ref != ''
uses: ./.github/workflows/deploy.yml
with:
cache_sha: ${{ github.event.pull_request.head.sha || github.sha }}
folder: ${{github.head_ref}}
deploy-public:
name: Deploy public
needs: [install-build]
if: github.event.pull_request.true == false && github.head_ref != ''
uses: ./.github/workflows/deploy.yml
with:
cache_sha: ${{ github.event.pull_request.head.sha || github.sha }}
folder: public