Skip to content

Commit 69c020a

Browse files
authored
ci: improve workflow (#88)
1 parent 192c66c commit 69c020a

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: Deploy ModAPI Dlls & Update Documentation
2-
on:
3-
push:
4-
branches:
5-
- master
2+
on: [push, pull_request]
63
jobs:
74
compile:
85
name: Compile ModAPI core DLLS
@@ -42,6 +39,7 @@ jobs:
4239
name: Deploy ModAPI DLLs update
4340
needs: compile
4441
runs-on: ubuntu-latest
42+
if: github.ref == 'refs/heads/master'
4543
steps:
4644
- name: Download compiled files
4745
uses: actions/download-artifact@v4
@@ -51,12 +49,6 @@ jobs:
5149
- name: Create update bundle
5250
run: zip SporeModAPIdlls.zip SporeModAPI.march2017.dll SporeModAPI.disk.dll SporeModAPI.combined.dll SporeModAPI.lib
5351

54-
# - name: Upload dlls bundle
55-
# uses: actions/upload-artifact@v3.1.3
56-
# with:
57-
# name: compiled-modapi-dlls-bundle
58-
# path: SporeModAPIdlls.zip
59-
6052
- name: Checkout repository
6153
uses: actions/checkout@v4
6254
with:
@@ -89,6 +81,7 @@ jobs:
8981
documentation:
9082
name: Generate documentation
9183
runs-on: ubuntu-latest
84+
if: github.ref == 'refs/heads/master'
9285
steps:
9386
- name: Install Doxygen
9487
uses: ssciwr/doxygen-install@v1.2.0
@@ -126,12 +119,16 @@ jobs:
126119
git init
127120
git config --local user.email "github-actions[bot]@users.noreply.github.com"
128121
git config --local user.name "github-actions[bot]"
129-
git remote add origin https://github.com/emd4600/Spore-ModAPI.git
122+
git remote add origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git
130123
git fetch
131124
git symbolic-ref HEAD refs/remotes/origin/gh-pages
132125
git reset
133-
git add .
134-
git commit -m "Documentation update $count"
126+
# only commit when uncomitted changes are available
127+
if [[ "$(git diff --name-only refs/remotes/origin/gh-pages | wc -l)" != "0" ]]
128+
then
129+
git add .
130+
git commit -m "Documentation update $count"
131+
fi
135132
136133
- name: Upload changes to GitHub
137134
uses: ad-m/github-push-action@master

0 commit comments

Comments
 (0)