Skip to content

Commit

Permalink
jctong/automate release (#45)
Browse files Browse the repository at this point in the history
* ci(travis): github release via pushing git tag

* linting issue

* simplify

* simplify some more

* remove whitespace
  • Loading branch information
juancarlostong authored May 5, 2020
1 parent cec5081 commit 7c28667
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ os: linux
stages:
- 'Lint markdown files'
- 'Test'
- 'Publish'

jobs:
include:
Expand All @@ -30,9 +31,25 @@ jobs:
- stage: 'Test'
os: linux
language: node_js
node_js:
- 10
node_js: 10
install: yarn
script: yarn test
addons:
srcclr: true

- stage: 'Publish'
if: type = push AND tag IS present AND tag =~ /^[0-9]+\.[0-9]+\.[0-9]+/
name: publish to github release
os: linux
language: minimal
install:
# installs hub to /tmp/bin
- URL=$(curl https://api.github.com/repos/github/hub/releases/latest 2>/dev/null | jq -r '.assets[] | select(.browser_download_url | contains("linux-amd64")) | .browser_download_url')
- curl -fsSL "$URL" | tar xz -C /tmp --strip-components=1 --wildcards '*/bin/hub'
- export PATH=/tmp/bin:$PATH
- hub version
script:
- NEW_VERSION=$(grep -P '^## \[\d+\.\d+\.\d+.*\]' CHANGELOG.md | awk 'NR==1' | sed -e 's/\[/\\\[/' | sed -e 's/\]/\\\]/')
- LAST_VERSION=$(grep -P '^## \[\d+\.\d+\.\d+.*\]' CHANGELOG.md | awk 'NR==2' | sed -e 's/\[/\\\[/' | sed -e 's/\]/\\\]/')
- DESCRIPTION=$(awk "/^${NEW_VERSION}$/,/^${LAST_VERSION:-nothingmatched}$/" CHANGELOG.md | grep -v "^${LAST_VERSION:-nothingmatched}$")
- hub release create -m "Release ${TRAVIS_TAG}" -m "${DESCRIPTION}" "${TRAVIS_TAG}"

0 comments on commit 7c28667

Please sign in to comment.