diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 45af95a7cab8a5835ce5bca667fc9ac7e0d65563..65f75dca7d6f2690a1271e5cf4e46852c846aab0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,8 @@ build-release: stage: build # scheduled runs are only for housekeeping 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: - NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4) - make sinologie-anki-pack-$NPM_VERSION @@ -44,7 +45,7 @@ build-release: release-package-json-version-as-git-tag: stage: release 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" script: - NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4) @@ -68,6 +69,9 @@ prepare-gitlab-release: rules: # 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 + needs: + - job: build-release + artifacts: true script: - NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4) - NPM_VERSION_GIT_TAG=$(git tag --sort=-v:refname | grep ^${NPM_VERSION}$) @@ -93,8 +97,6 @@ create-gitlab-release: rules: - if: $CI_COMMIT_TAG needs: - - job: build-release - artifacts: true - job: prepare-gitlab-release artifacts: true script: @@ -107,4 +109,29 @@ create-gitlab-release: links: - name: "$RELEASE_ZIP" url: '$RELEASE_ZIP_DOWNLOAD_URL' - \ No newline at end of file + +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