diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a2663807f9f679c2652b6f5edfb1c3aac749f21..448f1289147859636c0933c1373b50c4b4983728 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 ccefda77685591c1e255e508c21a181acedde2e1..bedf5c86e897d89475f541cf51f6dc57de6c4673 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ pipenv \ nodejs \ npm \ make \ -zip +zip \ +git RUN npm install --global yarn