mantra/.drone.yml

79 lines
1.9 KiB
YAML

name: mantra
kind: pipeline
type: docker
steps:
- name: install
image: manuth/silverstripe-dev
commands:
- composer install
- name: build
image: manuth/silverstripe-dev
commands:
- composer build
- name: lint
image: manuth/silverstripe-dev
commands:
- composer lint
# - name: test
# image: manuth/silverstripe-dev
# commands:
# - composer test
# - name: publish package
# image: manuth/silverstripe-dev
# 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: manuth/silverstripe-dev
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