-
Notifications
You must be signed in to change notification settings - Fork 34
92 lines (81 loc) · 2.9 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Deploy process on Pull Request
on:
pull_request_target:
types: [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.actor }}
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.actor }}
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]
if: github.event.pull_request.merged == false || github.event.pull_request.merged == true
uses: ./.github/workflows/build.yml
with:
cache_sha: ${{ github.event.pull_request.head.sha || github.sha }}
# remove-old-artifacts:
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# - name: Remove old artifacts
# uses: c-hive/[email protected]
# with:
# age: '15 days' # '<number> <unit>', e.g. 5 days, 2 years, 90 seconds, parsed by Moment.js
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# skip-recent: 10
# Optional inputs
# skip-tags: true
# skip-recent: 5
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.merged == true && github.head_ref != ''
uses: ./.github/workflows/deploy.yml
with:
cache_sha: ${{ github.event.pull_request.head.sha || github.sha }}
folder: public