mantra/.drone.yml

80 lines
1.8 KiB
YAML
Raw Normal View History

2021-05-11 02:21:19 +00:00
name: mantra
kind: pipeline
type: docker
steps:
- name: install
image: manuth/silverstripe-dev
commands:
- composer install
- name: build
image: node
commands:
- composer build
- name: lint
image: node
commands:
- composer lint
# - name: test
# image: node
# commands:
# - composer test
# - name: publish package
# image: node
# environment:
# NPM_TOKEN:
# from_secret: npm_token
# commands:
# - echo "//registry.npmjs.org/:_authToken=$${NPM_TOKEN}" > ~/.npmrc
# - npm publish
# when:
# event:
# - tag
# ref:
# - refs/tags/v[0-9].[0-9].[0-9]
- name: prepare release
image: node
commands:
- composer archive
- npm install escape-string-regexp --no-save
- node -e "console.log(require('escape-string-regexp')('${DRONE_TAG}'))" > TagName.txt
when:
event:
- tag
- name: prepare release notes
image: alpine
commands:
- export TagName=$$(cat TagName.txt)
- export TagHeading="/## \(.* \($${TagName}\|\[$${TagName}\]\)\)\$/"
- export HeadingPattern='/## \(.* \(v[0-9.]*\|\[.*\]\)\)/'
- cp -f CHANGELOG.md ReleaseNotes.md
- sed -i "1,$${TagHeading}{ $${TagHeading}P ; d } ; $${HeadingPattern},\$d" ReleaseNotes.md
- cp -f ReleaseNotes.md ReleaseTitle.md
- sed -i "2,\$d ; s$${HeadingPattern}\\\\1/" ReleaseTitle.md
when:
event:
- tag
- name: publish release
image: plugins/github-release
commands: []
settings:
api_key:
from_secret: github_publish_token
files:
- "*.tar"
title: ReleaseTitle.md
note: ReleaseNotes.md
when:
event:
- tag
trigger:
ref:
- refs/heads/**
- refs/pull/**
- refs/tags/**
event:
- push
- pull_request
- tag