Skip to content
Snippets Groups Projects
Commit 7082d082 authored by Philipp Stadler's avatar Philipp Stadler
Browse files

feat: add whatsapp ping back into CI

Add a CI rule again that sends a WhatsApp message to keep the login alive.
parent 12fc77e7
No related branches found
No related tags found
1 merge request!21feat: add whatsapp ping stage
Pipeline #9696 passed
...@@ -30,7 +30,8 @@ build-release: ...@@ -30,7 +30,8 @@ build-release:
stage: build stage: build
# scheduled runs are only for housekeeping # scheduled runs are only for housekeeping
rules: rules:
- if: $CI_PIPELINE_SOURCE != "schedule" # run build both on main and on MRs
- if: $CI_PIPELINE_SOURCE != "schedule" && ($CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "main")
script: script:
- NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4) - NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4)
- make sinologie-anki-pack-$NPM_VERSION - make sinologie-anki-pack-$NPM_VERSION
...@@ -44,7 +45,7 @@ build-release: ...@@ -44,7 +45,7 @@ build-release:
release-package-json-version-as-git-tag: release-package-json-version-as-git-tag:
stage: release stage: release
rules: rules:
# tagging should only happen after the thing was merged # tagging should only happen after the thing was merged, so do it on the main branch build
- if: $CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_BRANCH == "main" - if: $CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_BRANCH == "main"
script: script:
- NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4) - NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4)
...@@ -68,6 +69,9 @@ prepare-gitlab-release: ...@@ -68,6 +69,9 @@ prepare-gitlab-release:
rules: rules:
# run when a tag is created, either by the job above or manually by a user (to create releases from older commits) # run when a tag is created, either by the job above or manually by a user (to create releases from older commits)
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
needs:
- job: build-release
artifacts: true
script: script:
- NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4) - NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4)
- NPM_VERSION_GIT_TAG=$(git tag --sort=-v:refname | grep ^${NPM_VERSION}$) - NPM_VERSION_GIT_TAG=$(git tag --sort=-v:refname | grep ^${NPM_VERSION}$)
...@@ -93,8 +97,6 @@ create-gitlab-release: ...@@ -93,8 +97,6 @@ create-gitlab-release:
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
needs: needs:
- job: build-release
artifacts: true
- job: prepare-gitlab-release - job: prepare-gitlab-release
artifacts: true artifacts: true
script: script:
...@@ -108,3 +110,28 @@ create-gitlab-release: ...@@ -108,3 +110,28 @@ create-gitlab-release:
- name: "$RELEASE_ZIP" - name: "$RELEASE_ZIP"
url: '$RELEASE_ZIP_DOWNLOAD_URL' url: '$RELEASE_ZIP_DOWNLOAD_URL'
whatsapp-ping:
stage: notify
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
script:
- mudslide --cache .build-cache login || exit_code=$?
- mudslide --cache .build-cache send me "Good news, you are still logged into CI!"
whatsapp-announce-release:
stage: notify
# rules:
# - if: $CI_COMMIT_TAG
# needs:
# - job: prepare-gitlab-release
# artifacts: true
script:
# the command fails even if it succeeds sometimes
- mudslide --cache .build-cache login || exit_code=$?
# - 'mudslide --cache .build-cache send $WHATSAPP_RELEASE_NOTIFY_RECIPIENT "Sinologie Anki Pack $NPM_VERSION ist released! 🎉\nDownload: $RELEASE_ZIP_DOWNLOAD_URL\nDetails zum Release: https://gitlab.phaidra.org/kartenaale/sinologie-anki-pack/-/releases\nViel Spaß beim lernen!"'
- mudslide --cache .build-cache groups
- mudslide --cache .build-cache send --help
- for APKG in ls sinologie-anki-pack-*/*.apkg
- do
- mudslide --cache .build-cache send-file $WHATSAPP_RELEASE_NOTIFY_RECIPIENT $APKG
- done
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment