diff options
author | Vijay A <avijayr@protonmail.com> | 2021-07-27 09:57:42 +0530 |
---|---|---|
committer | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-07-27 04:56:34 +0000 |
commit | b0e72d1bd1761b60ee1486631d225a3dd91b9d77 (patch) | |
tree | 044eb71ee798e89abf34c39a8afbae8e28dda7c9 | |
parent | Allow to run 'npm version' without dependency on git pre-commit hook. [skip ci] (diff) | |
download | ferdium-app-b0e72d1bd1761b60ee1486631d225a3dd91b9d77.tar.gz ferdium-app-b0e72d1bd1761b60ee1486631d225a3dd91b9d77.tar.zst ferdium-app-b0e72d1bd1761b60ee1486631d225a3dd91b9d77.zip |
Moved the version-bump into the 'ferdi-builds' workflow so that its 'atomic' in nature of the actual scheduled build.
-rw-r--r-- | .github/workflows/dependency-updates.yml | 5 | ||||
-rw-r--r-- | .github/workflows/ferdi-builds.yml | 27 |
2 files changed, 18 insertions, 14 deletions
diff --git a/.github/workflows/dependency-updates.yml b/.github/workflows/dependency-updates.yml index 460256e6a..eca47ee90 100644 --- a/.github/workflows/dependency-updates.yml +++ b/.github/workflows/dependency-updates.yml | |||
@@ -29,7 +29,6 @@ jobs: | |||
29 | - name: Extract Git branch name and commit from the currently checked out branch (not from the branch where this run was kicked off) | 29 | - name: Extract Git branch name and commit from the currently checked out branch (not from the branch where this run was kicked off) |
30 | run: | | 30 | run: | |
31 | echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | 31 | echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV |
32 | echo "GIT_COMMIT=$(git log -1 --format='%H')" >> $GITHUB_ENV | ||
33 | shell: bash | 32 | shell: bash |
34 | - name: Cache node modules | 33 | - name: Cache node modules |
35 | uses: actions/cache@v2 | 34 | uses: actions/cache@v2 |
@@ -64,9 +63,5 @@ jobs: | |||
64 | git config user.name github-actions | 63 | git config user.name github-actions |
65 | git config user.email github-actions@github.com | 64 | git config user.email github-actions@github.com |
66 | git commit -am "Update submodules, browserslist data updates and linter fixes [skip ci]" --no-verify || true | 65 | git commit -am "Update submodules, browserslist data updates and linter fixes [skip ci]" --no-verify || true |
67 | echo "CHANGES_COUNT=$(git diff ${{ env.GIT_COMMIT }} | wc -l)" >> $GITHUB_ENV | ||
68 | - name: Bump version number if this is a scheduled build with changes or has been manually triggered with 'version bump' in the text, then bump the version number | ||
69 | if: ${{ (github.event_name == 'schedule' && env.CHANGES_COUNT != '0') || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'version bump')) }} | ||
70 | run: npm version prerelease --preid=nightly | ||
71 | - name: Push all changes | 66 | - name: Push all changes |
72 | run: git push origin ${{ env.GIT_BRANCH_NAME }} --no-verify | 67 | run: git push origin ${{ env.GIT_BRANCH_NAME }} --no-verify |
diff --git a/.github/workflows/ferdi-builds.yml b/.github/workflows/ferdi-builds.yml index 3e53d4e71..5bc20ff23 100644 --- a/.github/workflows/ferdi-builds.yml +++ b/.github/workflows/ferdi-builds.yml | |||
@@ -41,22 +41,31 @@ 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 | fetch-depth: 0 # Note: Needed to be able to pull the 'develop' branch as well for merging |
49 | - id: should_run | 49 | - id: should_run |
50 | 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 |
51 | 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]')) }} |
52 | run: | | 52 | run: | |
53 | git config user.name github-actions | 53 | git config user.name github-actions |
54 | git config user.email github-actions@github.com | 54 | git config user.email github-actions@github.com |
55 | 55 | ||
56 | CHANGES_COUNT=$(git diff --shortstat origin/develop | wc -l) | ||
57 | if [ $CHANGES_COUNT -gt 0 ] || [ {{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[version bump]') }} ]; then | ||
58 | # Do the version bump in the 'develop' branch ONLY if there were other changes coming from the 'develop' branch | ||
59 | git checkout develop | ||
60 | npm version -m "%s [skip ci]" prerelease --preid=nightly | ||
61 | git push origin develop | ||
62 | |||
63 | git checkout nightly | ||
64 | fi | ||
65 | |||
56 | echo "Merge with fast-forward from 'origin/develop'" | 66 | echo "Merge with fast-forward from 'origin/develop'" |
57 | git merge --ff-only origin/develop --no-verify | 67 | git merge --ff-only origin/develop --no-verify |
58 | 68 | ||
59 | CHANGES_COUNT=$(git diff --shortstat origin/nightly | wc -l) | ||
60 | MANUAL_REBUILD="${{ github.event_name == 'workflow_dispatch' }}" | 69 | MANUAL_REBUILD="${{ github.event_name == 'workflow_dispatch' }}" |
61 | echo "Number of changes: $CHANGES_COUNT" | 70 | echo "Number of changes: $CHANGES_COUNT" |
62 | if [ $CHANGES_COUNT -eq 0 ] && [ $MANUAL_REBUILD != "true" ]; then | 71 | if [ $CHANGES_COUNT -eq 0 ] && [ $MANUAL_REBUILD != "true" ]; then |
@@ -70,7 +79,7 @@ jobs: | |||
70 | build_mac: | 79 | build_mac: |
71 | name: 'macos ${{ github.event.inputs.message }}' | 80 | name: 'macos ${{ github.event.inputs.message }}' |
72 | needs: check_updates | 81 | needs: check_updates |
73 | 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'))))) }} | 82 | 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]'))))) }} |
74 | runs-on: macos-10.15 | 83 | runs-on: macos-10.15 |
75 | steps: | 84 | steps: |
76 | - name: Set env vars | 85 | - name: Set env vars |
@@ -78,7 +87,7 @@ jobs: | |||
78 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV | 87 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV |
79 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV | 88 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV |
80 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV | 89 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV |
81 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | 90 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]') }}" >> $GITHUB_ENV |
82 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | 91 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV |
83 | - 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 | 92 | - 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 |
84 | uses: actions/checkout@v2 | 93 | uses: actions/checkout@v2 |
@@ -167,7 +176,7 @@ jobs: | |||
167 | build_linux: | 176 | build_linux: |
168 | name: 'ubuntu ${{ github.event.inputs.message }}' | 177 | name: 'ubuntu ${{ github.event.inputs.message }}' |
169 | needs: check_updates | 178 | needs: check_updates |
170 | 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'))))) }} | 179 | 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]'))))) }} |
171 | runs-on: ubuntu-20.04 | 180 | runs-on: ubuntu-20.04 |
172 | steps: | 181 | steps: |
173 | - name: Set env vars | 182 | - name: Set env vars |
@@ -175,7 +184,7 @@ jobs: | |||
175 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV | 184 | echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV |
176 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV | 185 | echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV |
177 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV | 186 | echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV |
178 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | 187 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]') }}" >> $GITHUB_ENV |
179 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | 188 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV |
180 | - 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 | 189 | - 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 |
181 | uses: actions/checkout@v2 | 190 | uses: actions/checkout@v2 |
@@ -254,7 +263,7 @@ jobs: | |||
254 | build_windows: | 263 | build_windows: |
255 | name: 'windows ${{ github.event.inputs.message }}' | 264 | name: 'windows ${{ github.event.inputs.message }}' |
256 | needs: check_updates | 265 | needs: check_updates |
257 | 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'))))) }} | 266 | 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]'))))) }} |
258 | runs-on: windows-2019 | 267 | runs-on: windows-2019 |
259 | steps: | 268 | steps: |
260 | - name: Set env vars | 269 | - name: Set env vars |
@@ -263,7 +272,7 @@ jobs: | |||
263 | echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV | 272 | echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV |
264 | echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV | 273 | echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV |
265 | echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV | 274 | echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV |
266 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV | 275 | echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]') }}" >> $GITHUB_ENV |
267 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV | 276 | echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV |
268 | shell: bash | 277 | shell: bash |
269 | - 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 | 278 | - 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 |