From b4bce3035c269c613349e6b6e2dc78d3fabf0f4c Mon Sep 17 00:00:00 2001 From: Hugo Renard Date: Wed, 8 Jun 2022 17:45:11 +0200 Subject: [PATCH] (ci) add release job --- .gitlab-ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50145b4..e795dea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,49 @@ +stages: + - package + - upload + - release + package: - image: - name: node:17 + image: node:17 + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH script: - npm ci - npm run package artifacts: paths: - dist/ - only: - - main + +upload: + stage: upload + rules: + - if: $CI_COMMIT_TAG + variables: + SCIM_FILE: scim_$CI_COMMIT_TAG}.zip + script: + - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "dist/${SCIM_FILE}" "${PACKAGE_REGISTRY_URL}/${SCIM_FILE}"' + needs: + - job: package + artifacts: true + +release_job: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + rules: + - if: $CI_COMMIT_TAG + variables: + SCIM_FILE: scim_$CI_COMMIT_TAG}.zip + EXTRA_DESCRIPTION: "" + script: + - echo "running release_job" + release: + name: "Release $CI_COMMIT_TAG" + description: "Created using the release-cli $EXTRA_DESCRIPTION" + tag_name: "$CI_COMMIT_TAG" + ref: "$CI_COMMIT_TAG" + assets: + links: + - name: "scim" + url: "${PACKAGE_REGISTRY_URL}/${SCIM_FILE}" + filepath: "/scim" + link_type: "package"