Skip to content

Commit

Permalink
Automate releases with GitHub Actions (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
FloEdelmann authored Jan 20, 2020
1 parent 5cbd4a3 commit 155eccc
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release
on:
pull_request:
types: closed
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: |
github.event.pull_request.merged​ && (
contains(github.event.pull_request.labels.*.name, 'npm-patch') ||
contains(github.event.pull_request.labels.*.name, 'npm-minor') ||
contains(github.event.pull_request.labels.*.name, 'npm-major')
)
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js v12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Setup git and npm
run: |
git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git​
git config user.name "Flo Edelmann"
git config user.email "florian-edelmann@online.de"
npm config set //registry.npmjs.org/:_authToken=$NPM_API_TOKEN
- name: Bump patch version
if: contains(github.event.pull_request.labels.*.name, 'npm-patch')
run: npm version patch --force -m "Version %s"​
- name: Bump minor version
if: contains(github.event.pull_request.labels.*.name, 'npm-minor')
run: npm version minor --force -m "Version %s"​
- name: Bump major version
if: contains(github.event.pull_request.labels.*.name, 'npm-major')
run: npm version major --force -m "Version %s"​
- name: Release new version
run: |
npm publish
git push gh-origin HEAD:master --tags
VERSION_NUMBER=$(git tag --list | tail -n 1 | cut -d v -f 2)
echo "::set-env name=VERSION_NUMBER::$VERSION_NUMBER"
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: v${{ env.VERSION_NUMBER }}
release_name: Version ${{ env.VERSION_NUMBER }}
body: |
**NEW:**
**FIXED:**
**IMPROVED:**
**META:**
**BREAKING:**
draft: true
prerelease: false
env:
NPM_API_TOKEN: ${{ secrets.NPM_API_TOKEN }}​
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"module": "./dist/embetty-vue.esm.js",
"scripts": {
"watch": "rollup -c -w",
"build": "rollup -c"
"build": "rollup -c",
"version": "npm run build && git add -A dist"
},
"dependencies": {},
"devDependencies": {
Expand Down

0 comments on commit 155eccc

Please sign in to comment.