From 900f668dd5f93297d61b05a64d8f2e8f077f2a2c Mon Sep 17 00:00:00 2001 From: Philipp Stadler <a51820432@unet.univie.ac.at> Date: Sun, 7 Jan 2024 16:57:29 +0100 Subject: [PATCH] feat: first attempt at automatic tagging on main --- .gitlab-ci.yml | 20 ++++++++++++++++++++ Dockerfile | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a26638..448f128 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: durcheinander/sinologie-anki-pack-build:latest stages: - lint - build + - publish default: cache: @@ -29,3 +30,22 @@ build-release: # release both the archive and the uncompressed build directory # (sinologie-anki-pack-*.zip would release just the zip) - sinologie-anki-pack-* + +publish-package-json-version-as-git-tag: + stage: publish + only: + refs: + - main + script: + - NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4) + - MATCHING_GIT_TAG=$(git tag | grep ^NPM_VERSION$) + - if [ -z $MATCHING_GIT_TAG ]; then + - echo adding git tag for first commit on main with NPM version ${NPM_VERSION} + - git remote remove origin + - git remote add origin https://oauth:${REPOSITORY_ACCESS_TOKEN}@gitlab.phaidra.org/kartenaale/sinologie-anki-pack.git + - git config user.email Cao Cao + - git config user.name cao.cao@ci.kartenaale + - git tag -a $NPM_VERSION -m "Release $NPM_VERSION" + - else + - ' echo package-json-tag: keeping older tag for $NPM_VERSION' + - fi \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ccefda7..bedf5c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ pipenv \ nodejs \ npm \ make \ -zip +zip \ +git RUN npm install --global yarn -- GitLab