aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar André Oliveira <37463445+SpecialAro@users.noreply.github.com>2022-06-02 19:10:26 +0100
committerLibravatar GitHub <noreply@github.com>2022-06-02 19:10:26 +0100
commite7625709c73c98ab23ac982732ac0822f93e6a0f (patch)
tree033fac21b625222c9743feea96edf230df4891e6
parentFix pnpm version on entrypoint.sh (diff)
downloadferdium-server-e7625709c73c98ab23ac982732ac0822f93e6a0f.tar.gz
ferdium-server-e7625709c73c98ab23ac982732ac0822f93e6a0f.tar.zst
ferdium-server-e7625709c73c98ab23ac982732ac0822f93e6a0f.zip
Fix gh actions (#38)
* Manual version bump * Fix GH Actions * Add fix to not publish for every commit * Fixes reviews
-rw-r--r--.github/workflows/docker.yml44
-rw-r--r--package.json2
2 files changed, 43 insertions, 3 deletions
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index cb04285..d54ef79 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -4,8 +4,6 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - 'main' 6 - 'main'
7 tags:
8 - 'v*'
9 7
10jobs: 8jobs:
11 docker: 9 docker:
@@ -14,6 +12,47 @@ jobs:
14 - 12 -
15 name: Checkout 13 name: Checkout
16 uses: actions/checkout@v3 14 uses: actions/checkout@v3
15 -
16 name: Check whether there are any commits since this run was last triggered and push them and/or set the output
17 id: should_run
18 if: ${{ (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[main]')) }}
19 run: |
20 git config user.name github-actions
21 git config user.email github-actions@github.com
22
23 # Defensive: update submodules in the main branch
24 git checkout main
25 git submodule update --init --recursive --remote --rebase --force
26 git add .
27 git commit -am "Update submodules [skip ci]" --no-verify || true
28 git push origin main --no-verify
29 git checkout -
30
31 git submodule update --init --recursive --remote --rebase --force
32
33 CHANGES_COUNT=$(git diff --shortstat origin/main | wc -l)
34 MANUAL_REBUILD="${{ github.event_name == 'workflow_dispatch' }}"
35 VERSION_BUMP="${{ contains(github.event.inputs.message, '[version bump]') }}"
36 if [ $CHANGES_COUNT -gt 0 ] || [[ $MANUAL_REBUILD == "true" && $VERSION_BUMP == "true" ]]; then
37 # Do the version bump in the 'main' branch ONLY if
38 # there were other changes coming from the 'main' branch (or)
39 # this is a manual trigger with the key-phrase
40 git checkout main
41 TAG_NAME=$(npm version -m "%s [skip ci]" patch)
42 git commit --all --amend --no-edit --no-verify
43 git push origin main --no-verify
44 git tag -f $TAG_NAME
45 git push origin --tags --no-verify
46 fi
47
48 echo "Number of changes: $CHANGES_COUNT"
49 if [ $CHANGES_COUNT -eq 0 ] && [ $MANUAL_REBUILD != "true" ]; then
50 echo "No changes found - terminating the build"
51 echo "::set-output name=should_run::false"
52 else # changes > 0 (or) MANUAL_REBUILD=true
53 echo "Pushing rebased commits"
54 git push origin $(git rev-parse --abbrev-ref HEAD) --no-verify
55 fi
17 - 56 -
18 name: Docker meta 57 name: Docker meta
19 id: meta 58 id: meta
@@ -48,6 +87,7 @@ jobs:
48 password: ${{ secrets.DOCKERHUB_TOKEN }} 87 password: ${{ secrets.DOCKERHUB_TOKEN }}
49 - 88 -
50 name: Build and push 89 name: Build and push
90 if: ${{ (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[main]')) }}
51 uses: docker/build-push-action@v3 91 uses: docker/build-push-action@v3
52 with: 92 with:
53 context: . 93 context: .
diff --git a/package.json b/package.json
index f3fe3b2..959bddf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
1{ 1{
2 "name": "ferdium-server", 2 "name": "ferdium-server",
3 "version": "1.3.2", 3 "version": "1.3.6",
4 "adonis-version": "4.1.0", 4 "adonis-version": "4.1.0",
5 "description": "Ferdium server to replace the default Franz/Ferdi server.", 5 "description": "Ferdium server to replace the default Franz/Ferdi server.",
6 "main": "index.js", 6 "main": "index.js",