diff options
Diffstat (limited to '.github/workflows/ferdi-builds.yml')
-rw-r--r-- | .github/workflows/ferdi-builds.yml | 82 |
1 files changed, 63 insertions, 19 deletions
diff --git a/.github/workflows/ferdi-builds.yml b/.github/workflows/ferdi-builds.yml index f326abfd5..d9627c816 100644 --- a/.github/workflows/ferdi-builds.yml +++ b/.github/workflows/ferdi-builds.yml | |||
@@ -26,7 +26,7 @@ on: | |||
26 | description: 'Message for build' | 26 | description: 'Message for build' |
27 | required: true | 27 | required: true |
28 | schedule: | 28 | schedule: |
29 | - cron: '0 1 * * *' # every night at 1 am (to allow for dependency builds to complete) | 29 | - cron: '15 0 * * *' # every night at 12:15 am (to allow for dependency builds to complete) |
30 | 30 | ||
31 | env: | 31 | env: |
32 | USE_HARD_LINKS: false | 32 | USE_HARD_LINKS: false |
@@ -41,22 +41,35 @@ jobs: | |||
41 | steps: | 41 | steps: |
42 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' | 42 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' |
43 | uses: actions/checkout@v2 | 43 | uses: actions/checkout@v2 |
44 | if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }} | 44 | if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }} |
45 | with: | 45 | with: |
46 | ref: nightly | 46 | ref: nightly |
47 | submodules: recursive | 47 | submodules: recursive |
48 | fetch-depth: 0 # Note: Needed to be able to pull the 'develop' branch as well for merging | ||
48 | - id: should_run | 49 | - id: should_run |
49 | name: Check whether there are any commits since this run was last triggered and push them and/or set the output | 50 | name: Check whether there are any commits since this run was last triggered and push them and/or set the output |
50 | if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }} | 51 | if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }} |
51 | run: | | 52 | run: | |
52 | git config user.name github-actions | 53 | git config user.name github-actions |
53 | git config user.email github-actions@github.com | 54 | git config user.email github-actions@github.com |
54 | 55 | ||
56 | CHANGES_COUNT=$(git diff --shortstat origin/develop | wc -l) | ||
57 | MANUAL_REBUILD="${{ github.event_name == 'workflow_dispatch' }}" | ||
58 | VERSION_BUMP="${{ contains(github.event.inputs.message, '[version bump]') }}" | ||
59 | if [ $CHANGES_COUNT -gt 0 ] || [[ $MANUAL_REBUILD == "true" && $VERSION_BUMP == "true" ]]; then | ||
60 | # Do the version bump in the 'develop' branch ONLY if there were other changes coming from the 'develop' branch | ||
61 | git checkout develop | ||
62 | TAG_NAME=$(npm version -m "%s [skip ci]" prerelease --preid=nightly) | ||
63 | git push origin develop --no-verify | ||
64 | git tag -f $TAG_NAME | ||
65 | git push origin --tags --no-verify | ||
66 | |||
67 | git checkout nightly | ||
68 | fi | ||
69 | |||
55 | echo "Merge with fast-forward from 'origin/develop'" | 70 | echo "Merge with fast-forward from 'origin/develop'" |
56 | git merge --ff-only origin/develop --no-verify | 71 | git merge --ff-only origin/develop --no-verify |
57 | 72 | ||
58 | CHANGES_COUNT=$(git diff --shortstat origin/nightly | wc -l) | ||
59 | MANUAL_REBUILD="${{ github.event_name == 'workflow_dispatch' }}" | ||
60 | echo "Number of changes: $CHANGES_COUNT" | 73 | echo "Number of changes: $CHANGES_COUNT" |
61 | if [ $CHANGES_COUNT -eq 0 ] && [ $MANUAL_REBUILD != "true" ]; then | 74 | if [ $CHANGES_COUNT -eq 0 ] && [ $MANUAL_REBUILD != "true" ]; then |
62 | echo "No changes found - terminating the build" | 75 | echo "No changes found - terminating the build" |
@@ -69,7 +82,7 @@ jobs: | |||
69 | build_mac: | 82 | build_mac: |
70 | name: 'macos ${{ github.event.inputs.message }}' | 83 | name: 'macos ${{ github.event.inputs.message }}' |
71 | needs: check_updates | 84 | needs: check_updates |
72 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'macOS') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }} | 85 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[macOS]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} |
73 | runs-on: macos-10.15 | 86 | runs-on: macos-10.15 |
74 | steps: | 87 | steps: |
75 | - name: Set env vars | 88 | - name: Set env vars |
@@ -77,7 +90,7 @@ jobs: | |||
77 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV | 90 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV |
78 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV | 91 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV |
79 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV | 92 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV |
80 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | 93 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]') }}" >> $GITHUB_ENV |
81 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | 94 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV |
82 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch | 95 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch |
83 | uses: actions/checkout@v2 | 96 | uses: actions/checkout@v2 |
@@ -125,10 +138,11 @@ jobs: | |||
125 | run: | | 138 | run: | |
126 | sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/* | 139 | sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/* |
127 | sudo xcode-select -s "/Applications/Xcode_12.4.app" | 140 | sudo xcode-select -s "/Applications/Xcode_12.4.app" |
128 | - name: Uninstall locally and reinstall node-gyp globally | 141 | - name: Uninstall locally and reinstall global npm modules |
129 | run: | | 142 | run: | |
130 | npm uninstall node-gyp | 143 | npm uninstall node-gyp |
131 | npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)" | 144 | npm ls -g node-gyp@8.1.0 || npm i -g node-gyp@8.1.0 |
145 | npm ls -g lerna@4.0.0 || npm i -g lerna@4.0.0 | ||
132 | - name: Fix corrupted node cache | 146 | - name: Fix corrupted node cache |
133 | run: npm cache clean --force | 147 | run: npm cache clean --force |
134 | - name: Install node dependencies recursively | 148 | - name: Install node dependencies recursively |
@@ -166,7 +180,7 @@ jobs: | |||
166 | build_linux: | 180 | build_linux: |
167 | name: 'ubuntu ${{ github.event.inputs.message }}' | 181 | name: 'ubuntu ${{ github.event.inputs.message }}' |
168 | needs: check_updates | 182 | needs: check_updates |
169 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'Linux') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }} | 183 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[Linux]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} |
170 | runs-on: ubuntu-20.04 | 184 | runs-on: ubuntu-20.04 |
171 | steps: | 185 | steps: |
172 | - name: Set env vars | 186 | - name: Set env vars |
@@ -174,8 +188,9 @@ jobs: | |||
174 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV | 188 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV |
175 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV | 189 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV |
176 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV | 190 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV |
177 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | 191 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]') }}" >> $GITHUB_ENV |
178 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | 192 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV |
193 | echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | ||
179 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch | 194 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch |
180 | uses: actions/checkout@v2 | 195 | uses: actions/checkout@v2 |
181 | if: ${{ github.event_name == 'schedule' || env.MANUAL_REBUILD_ON_NIGHTLY == 'true' }} | 196 | if: ${{ github.event_name == 'schedule' || env.MANUAL_REBUILD_ON_NIGHTLY == 'true' }} |
@@ -218,10 +233,11 @@ jobs: | |||
218 | uses: actions/setup-node@v2 | 233 | uses: actions/setup-node@v2 |
219 | with: | 234 | with: |
220 | node-version: 14.17.3 | 235 | node-version: 14.17.3 |
221 | - name: Uninstall locally and reinstall node-gyp globally | 236 | - name: Uninstall locally and reinstall global npm modules |
222 | run: | | 237 | run: | |
223 | npm uninstall node-gyp | 238 | npm uninstall node-gyp |
224 | npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)" | 239 | npm ls -g node-gyp@8.1.0 || npm i -g node-gyp@8.1.0 |
240 | npm ls -g lerna@4.0.0 || npm i -g lerna@4.0.0 | ||
225 | - name: Fix corrupted node cache | 241 | - name: Fix corrupted node cache |
226 | run: npm cache clean --force | 242 | run: npm cache clean --force |
227 | - name: Install node dependencies recursively | 243 | - name: Install node dependencies recursively |
@@ -237,23 +253,45 @@ jobs: | |||
237 | shell: bash | 253 | shell: bash |
238 | - name: Build Ferdi with publish for 'nightly' branch | 254 | - name: Build Ferdi with publish for 'nightly' branch |
239 | if: ${{ env.GIT_BRANCH_NAME == 'nightly' }} | 255 | if: ${{ env.GIT_BRANCH_NAME == 'nightly' }} |
240 | run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=nightlies | ||
241 | shell: bash | ||
242 | env: | 256 | env: |
243 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} | 257 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} |
244 | CSC_IDENTITY_AUTO_DISCOVERY: false | 258 | CSC_IDENTITY_AUTO_DISCOVERY: false |
259 | SNAPCRAFT_LOGIN: ${{ secrets.SNAPCRAFT_LOGIN }} | ||
260 | run: | | ||
261 | sudo snap install snapcraft --classic | ||
262 | echo "$SNAPCRAFT_LOGIN" | snapcraft login --with - | ||
263 | npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=nightlies | ||
264 | snapcraft logout | ||
265 | shell: bash | ||
245 | - name: Build Ferdi with publish for 'release' branch | 266 | - name: Build Ferdi with publish for 'release' branch |
246 | if: ${{ env.GIT_BRANCH_NAME == 'release' }} | 267 | if: ${{ env.GIT_BRANCH_NAME == 'release' && contains(env.PACKAGE_VERSION, 'beta') }} |
247 | run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi | 268 | env: |
269 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} | ||
270 | CSC_IDENTITY_AUTO_DISCOVERY: false | ||
271 | SNAPCRAFT_LOGIN: ${{ secrets.SNAPCRAFT_LOGIN }} | ||
272 | run: | | ||
273 | sudo snap install snapcraft --classic | ||
274 | echo "$SNAPCRAFT_LOGIN" | snapcraft login --with - | ||
275 | npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi -c.snap.publish.channels=beta | ||
276 | snapcraft logout | ||
248 | shell: bash | 277 | shell: bash |
278 | - name: Build Ferdi with publish for 'release' branch | ||
279 | if: ${{ env.GIT_BRANCH_NAME == 'release' && !contains(env.PACKAGE_VERSION, 'beta') }} | ||
249 | env: | 280 | env: |
250 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} | 281 | GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }} |
251 | CSC_IDENTITY_AUTO_DISCOVERY: false | 282 | CSC_IDENTITY_AUTO_DISCOVERY: false |
283 | SNAPCRAFT_LOGIN: ${{ secrets.SNAPCRAFT_LOGIN }} | ||
284 | run: | | ||
285 | sudo snap install snapcraft --classic | ||
286 | echo "$SNAPCRAFT_LOGIN" | snapcraft login --with - | ||
287 | npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi -c.snap.publish.channels=stable | ||
288 | snapcraft logout | ||
289 | shell: bash | ||
252 | 290 | ||
253 | build_windows: | 291 | build_windows: |
254 | name: 'windows ${{ github.event.inputs.message }}' | 292 | name: 'windows ${{ github.event.inputs.message }}' |
255 | needs: check_updates | 293 | needs: check_updates |
256 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'Windows') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }} | 294 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[Windows]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} |
257 | runs-on: windows-2019 | 295 | runs-on: windows-2019 |
258 | steps: | 296 | steps: |
259 | - name: Set env vars | 297 | - name: Set env vars |
@@ -262,7 +300,7 @@ jobs: | |||
262 | echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV | 300 | echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV |
263 | echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV | 301 | echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV |
264 | echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV | 302 | echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV |
265 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | 303 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]') }}" >> $GITHUB_ENV |
266 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | 304 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV |
267 | shell: bash | 305 | shell: bash |
268 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch | 306 | - name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch |
@@ -307,6 +345,12 @@ jobs: | |||
307 | uses: actions/setup-node@v2 | 345 | uses: actions/setup-node@v2 |
308 | with: | 346 | with: |
309 | node-version: 14.17.3 | 347 | node-version: 14.17.3 |
348 | - name: Uninstall locally and reinstall global npm modules | ||
349 | run: | | ||
350 | npm uninstall node-gyp | ||
351 | npm ls -g node-gyp@8.1.0 || npm i -g node-gyp@8.1.0 | ||
352 | npm ls -g lerna@4.0.0 || npm i -g lerna@4.0.0 | ||
353 | shell: bash | ||
310 | - name: Fix corrupted node cache | 354 | - name: Fix corrupted node cache |
311 | run: npm cache clean --force | 355 | run: npm cache clean --force |
312 | shell: bash | 356 | shell: bash |