Skip to content

Commit

Permalink
Automate GitHub Releases
Browse files Browse the repository at this point in the history
  • Loading branch information
jessety committed Aug 30, 2020
1 parent 05adedc commit 22a511f
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: release

on:
push:
tags:
- 'v*' # Push events for tags matching v*, e.g. v1.0, v20.15.10

jobs:
build:
name: release
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # git history won't be fetched without this option

- name: Setup Node
uses: actions/setup-node@v1

- name: Install Dependencies
run: npm install

- name: Generate Release Notes
run: npx auto-changelog --template RELEASE.md.hbs --output RELEASE.md --commit-limit false

- name: Parse Release Notes
id: parse
run: |
NOTES=$(cat RELEASE.md)
NOTES="${NOTES//'%'/'%25'}"
NOTES="${NOTES//$'\n'/'%0A'}"
echo "::set-output name=notes::$NOTES"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.parse.outputs.notes }}
draft: false
prerelease: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
coverage
RELEASE.md
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ coverage
.editorconfig
.gitattributes
.github
RELEASE.md.hbs
RELEASE.md
16 changes: 16 additions & 0 deletions RELEASE.md.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{#each releases}}
{{#if @first}}
{{#if summary}}
{{summary}}
{{/if}}
{{#each merges}}
- {{message}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}
{{/each}}
{{#each fixes}}
- {{commit.subject}}{{#each fixes}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}{{/each}}
{{/each}}
{{#each commits}}
- {{subject}}{{#if href}} [`{{shorthash}}`]({{href}}){{/if}}
{{/each}}
{{/if}}
{{/each}}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"dependencies": {},
"devDependencies": {
"@jessety/eslint-config": "^1.0.5",
"auto-changelog": "^2.2.0",
"eslint": "^6.8.0",
"jest": "^25.4.0"
}
Expand Down

0 comments on commit 22a511f

Please sign in to comment.