-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (41 loc) · 1.29 KB
/
deploy.yml
File metadata and controls
46 lines (41 loc) · 1.29 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
name: 'Deploy'
on: push
jobs:
deploy:
if: startsWith(github.repository, 'ModdingX/') # don't run this in forks
runs-on: ubuntu-latest
steps:
- name: 'Checkout Base Branch'
uses: actions/checkout@v2
with:
path: base
- name: 'Checkout Deploy Branch'
uses: actions/checkout@v2
with:
ref: 'gh-pages'
path: deploy
- name: 'Installing dependencies'
run: sudo apt-get install -y gpp
- name: 'Copy Files'
shell: bash
run: |
BRANCH=$(echo ${GITHUB_REF#refs/heads/})
if [[ "${BRANCH}" != "" && "${BRANCH}" != *"/"* ]]; then
rm -rf "deploy/${BRANCH}"
mkdir -p "deploy/${BRANCH}"
cd base
rm -rf output
bash build.sh "${BRANCH}" "$(git rev-parse --short "$GITHUB_SHA")"
if [[ "$?" != "0" ]]; then
exit 1
fi
cp "output/"* "../deploy/${BRANCH}/"
fi
- name: 'Push'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_user_name: github-actions[bot]
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
commit_message: Deploy
repository: deploy
branch: 'gh-pages'