|
1 | 1 | name: Deploy ModAPI Dlls & Update Documentation |
2 | | -on: |
3 | | - push: |
4 | | - branches: |
5 | | - - master |
| 2 | +on: [push, pull_request] |
6 | 3 | jobs: |
7 | 4 | compile: |
8 | 5 | name: Compile ModAPI core DLLS |
|
42 | 39 | name: Deploy ModAPI DLLs update |
43 | 40 | needs: compile |
44 | 41 | runs-on: ubuntu-latest |
| 42 | + if: github.ref == 'refs/heads/master' |
45 | 43 | steps: |
46 | 44 | - name: Download compiled files |
47 | 45 | uses: actions/download-artifact@v4 |
|
51 | 49 | - name: Create update bundle |
52 | 50 | run: zip SporeModAPIdlls.zip SporeModAPI.march2017.dll SporeModAPI.disk.dll SporeModAPI.combined.dll SporeModAPI.lib |
53 | 51 |
|
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 | | - |
60 | 52 | - name: Checkout repository |
61 | 53 | uses: actions/checkout@v4 |
62 | 54 | with: |
|
89 | 81 | documentation: |
90 | 82 | name: Generate documentation |
91 | 83 | runs-on: ubuntu-latest |
| 84 | + if: github.ref == 'refs/heads/master' |
92 | 85 | steps: |
93 | 86 | - name: Install Doxygen |
94 | 87 | uses: ssciwr/doxygen-install@v1.2.0 |
@@ -126,12 +119,16 @@ jobs: |
126 | 119 | git init |
127 | 120 | git config --local user.email "github-actions[bot]@users.noreply.github.com" |
128 | 121 | 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 |
130 | 123 | git fetch |
131 | 124 | git symbolic-ref HEAD refs/remotes/origin/gh-pages |
132 | 125 | 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 |
135 | 132 |
|
136 | 133 | - name: Upload changes to GitHub |
137 | 134 | uses: ad-m/github-push-action@master |
|
0 commit comments