mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Triggered by version tags (vX.Y.Z), extracts the changelog section for the tagged version and creates a GitLab release with it.
57 lines
1.2 KiB
YAML
57 lines
1.2 KiB
YAML
image: node:25
|
|
|
|
default:
|
|
interruptible: true
|
|
timeout: 1 minute
|
|
|
|
stages:
|
|
- test
|
|
- deploy
|
|
- release
|
|
|
|
test:
|
|
stage: test
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
when: never
|
|
- when: always
|
|
script:
|
|
- npm run typecheck
|
|
- npm run build
|
|
- npm run test
|
|
|
|
pages:
|
|
stage: deploy
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
when: never
|
|
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
script:
|
|
- npm run build
|
|
- rm -rf public
|
|
- mv dist public
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
|
|
release:
|
|
stage: release
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
rules:
|
|
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
|
|
script:
|
|
- echo "Creating release for $CI_COMMIT_TAG"
|
|
# Extract the latest changelog section for the release description.
|
|
# Reads from "## [version]" to the next "## [" or end of file.
|
|
- |
|
|
VERSION="${CI_COMMIT_TAG#v}"
|
|
RELEASE_NOTES=$(awk "/^## \\[${VERSION}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md)
|
|
if [ -z "$RELEASE_NOTES" ]; then
|
|
RELEASE_NOTES="Shakespeare ${CI_COMMIT_TAG}"
|
|
fi
|
|
- echo "$RELEASE_NOTES" > release-notes.md
|
|
release:
|
|
tag_name: $CI_COMMIT_TAG
|
|
name: $CI_COMMIT_TAG
|
|
description: './release-notes.md'
|