Skip to content
Snippets Groups Projects
Commit 348b5ec4 authored by Jan Loewe's avatar Jan Loewe :speech_balloon:
Browse files

Merge branch 'ci-release-and-publish' into 'master'

[CI] add release and publish pipeline

See merge request !9
parents c2c9637c ca107661
No related branches found
No related tags found
1 merge request!9[CI] add release and publish pipeline
Pipeline #22990 passed
......@@ -3,6 +3,8 @@ image: node:18
stages:
- test
- release
- deploy
# === Caches ===
......@@ -78,3 +80,55 @@ lint:
- yarn run test:prettier
cache:
- <<: *yarn-cache
# === Job: Prepare Release
# Description: this job prepares an env file for an upcoming release
prepare_release:
stage: .pre
rules:
- if: $CI_COMMIT_TAG =~ /v.*/
script:
- ./scripts/createReleaseEnv.sh >> release.env
artifacts:
paths:
- release.description
reports:
dotenv: release.env
# === Job: Release
# Description: this job creates a new release using the provided env file
# === Variables ===
# NEXT_VER: the version of the upcoming release
# === Files ===
# release.description: multi-line description of the release
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: prepare_release
artifacts: true
rules:
- if: $CI_COMMIT_TAG =~ /v.*/
script:
- echo "running release_job for $NEXT_VER"
release:
name: '$NEXT_VER'
description: ./release.description
tag_name: '$NEXT_VER'
ref: '$CI_COMMIT_SHA'
# === Job: Deploy
# Description: this job creates publishes the package to the gitlab package registry
# === Variables ===
# NPM_AUTH_TOKEN: a deploy token with read_package_registry and write_package_registry scopes
deploy:
stage: deploy
needs: ["proxy"]
rules:
- if: $CI_COMMIT_TAG =~ /v.*/
script:
- *yarn-install
- yarn npm publish
nodeLinker: node-modules
npmPublishRegistry: "https://gitlab1.ptb.de/api/v4/projects/105/packages/npm/"
npmScopes:
d-ptb:
npmRegistryServer: "https://gitlab1.ptb.de/api/v4/packages/npm/"
npmPublishRegistry: "${CI_API_V4_URL:-https://gitlab1.ptb.de/api/v4}/projects/${CI_PROJECT_ID:-105}/packages/npm/"
npmRegistryServer: "${CI_API_V4_URL:-https://gitlab1.ptb.de/api/v4}/packages/npm/"
npmAlwaysAuth: true
npmAuthToken: "${NPM_AUTH_TOKEN:-}"
......@@ -17,7 +17,7 @@
"test": "concurrently -m 1 \"npm:test:*\"",
"test:lint": "eslint src --ext .ts",
"test:prettier": "prettier \"src/**/*.ts\" --list-different",
"test:unit": "vitest",
"test:unit": "vitest run",
"prepack": "npx rimraf lib && yarn run build",
"prepublish": "yarn run test"
},
......@@ -39,6 +39,7 @@
"ts-node": "^10.9.1",
"typescript": "^5.1.3",
"unplugin-auto-import": "^0.16.4",
"vite": "^4.3.9",
"vitest": "^0.32.2",
"vitest-environment-custom": "link:./tests/vitest-environment-custom",
"xpath-ts": "^1.3.13"
......
#!/usr/bin/env bash
mapfile -t TAGS < <(git tag --sort=creatordate --list "v*") # Read tags as array
NEXT_VER=${TAGS[-1]}
echo "NEXT_VER=${NEXT_VER}"
echo "# dcc-js ${NEXT_VER}
Support vx.y.z of the DCC" > release.description
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment