From 41e61651dd524b711f9afdb71c62cbc9bc43375c Mon Sep 17 00:00:00 2001
From: Philipp Stadler <hello@phstadler.com>
Date: Mon, 15 Jul 2024 18:30:39 +0200
Subject: [PATCH] chore: use common CI

---
 .gitlab-ci.yml | 94 ++------------------------------------------------
 1 file changed, 3 insertions(+), 91 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f37d36a..9717083 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,91 +1,3 @@
-image: durcheinander/export-apkgs:1.0.0
-
-stages:
-- build
-- release
-
-build:
-  stage: build
-  rules:
-    - if: $CI_PIPELINE_SOURCE == "schedule"
-      when: never
-    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
-    - if: $CI_COMMIT_TAG
-  script:
-    - curl https://gitlab.phaidra.org/kartenaale/card-templates/-/jobs/104428/artifacts/raw/card-templates-1.0.2.tar.gz | tar -xz
-    - export_apkgs -c content -t templates -o .
-    - echo "ARTIFACTS_URL=https://gitlab.phaidra.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/browse" > build.env
-  artifacts:
-    paths:
-      - '*.apkg'
-      - LICENSE
-      - NOTICE
-    reports:
-      dotenv: build.env
-
-changelog:
-  image:
-    name: orhunp/git-cliff:latest
-    entrypoint: [""]
-  rules:
-    - if: $CI_COMMIT_TAG
-  variables:
-    GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
-    GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
-  stage: build
-  script:
-    - git-cliff --latest -o CHANGELOG.md
-  artifacts:
-    paths:
-      - CHANGELOG.md
-
-release-package-json-version-as-git-tag:
-  stage: release
-  rules:
-    - if: $CI_PIPELINE_SOURCE == "schedule"
-      when: never
-    # tagging should only happen after the thing was merged, so do it on the main branch build
-    - if: $CI_COMMIT_BRANCH == "main"
-  # we don't need anything in node_modules or python, so don't fetch the cache
-  cache: []
-  script:
-    - NPM_VERSION=$(grep '"version":' package.json -m 1 | cut -d '"' -f 4)
-    # || exit_code=$? is the recommended way to ignore a non-zero exit code
-    - NPM_VERSION_GIT_TAG=$(git tag | grep ^${NPM_VERSION}$ || exit_code=$?)
-    - if [ -z "$NPM_VERSION_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/$CI_PROJECT_PATH.git
-    -     git config user.email Cao Cao
-    -     git config user.name cao.cao@ci.kartenaale
-    -     git tag -a $NPM_VERSION -m "Release $NPM_VERSION"
-    -     git push origin $NPM_VERSION
-    - else
-    - '   echo package-json-tag: keeping older tag for $NPM_VERSION'
-    - fi
-
-create-gitlab-release:
-  image: registry.gitlab.com/gitlab-org/release-cli:latest
-  stage: release
-  rules:
-    - if: $CI_COMMIT_TAG
-  needs:
-    - job: build
-      artifacts: true
-    - job: changelog
-      artifacts: true
-  variables:
-    # we just need the artifacts and don't need up-to-date source, so don't even fetch
-    GIT_STRATEGY: none
-  # we don't need anything in node_modules or python, so don't fetch the cache
-  cache: []
-  script:
-    - echo Creating GitLab release…
-  release:
-    tag_name: '$CI_COMMIT_TAG'
-    name: '$CI_COMMIT_TAG'
-    description: CHANGELOG.md
-    assets:
-      links:
-        - name: 'Browse all APKGS…'
-          url: '$ARTIFACTS_URL'
+include:
+- project: kartenaale/pack-ci
+  file: '.gitlab-ci.yml'
-- 
GitLab