-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate releases with GitHub Actions (#10)
- Loading branch information
1 parent
5cbd4a3
commit 155eccc
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters