Skip to content
Snippets Groups Projects
Verified Commit 4d53f219 authored by Jan Loewe's avatar Jan Loewe :speech_balloon:
Browse files

ci: release and publish package on tag

parent c2c9637c
No related branches found
No related tags found
1 merge request!9[CI] add release and publish pipeline
This commit is part of merge request !9. Comments created here will be created in the context of that merge request.
......@@ -3,6 +3,8 @@ image: node:18
stages:
- test
- release
- deploy
# === Caches ===
......@@ -78,3 +80,51 @@ 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
deploy:
stage: deploy
before_script:
- corepack enable
- yarn set version stable
script:
- yarn npm publish
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment