Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,15 @@
"ts": "never",
}
]
}
},
"overrides": [
{
"files": ["scripts/*.js"],
"env": { "node": true },
"rules": {
"@typescript-eslint/no-var-requires": ["off"],
"no-console": ["off"]
}
}
]
}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Create release
on:
push:
tags:
- 'v*'

jobs:
release:
name: Create release
runs-on: ubuntu-18.04

steps:
- name: Checkout repo
uses: actions/checkout@master
- name: Setup Node.js version
uses: actions/setup-node@master
with:
node-version: '12.16.1'

- name: Generate release body
run: |
yarn extract-latest-change-log
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
body_path: RELEASE_BODY.md
3 changes: 3 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"header": "# Changelog\n"
}
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.0.1](https://github.com/icelam/html-inline-script-webpack-plugin/compare/v1.0.0...v1.0.1) (2021-01-22)


Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"lint": "eslint --ext .ts,js src",
"prepare": "install-peers",
"first-release": "npx standard-version --commit-all --tag-prefix v --first-release",
"release": "npx standard-version --commit-all --tag-prefix v"
"release": "npx standard-version --commit-all --tag-prefix v",
"extract-latest-change-log": "node scripts/extractLatestChangeLog.js"
},
"author": "Ice Lam",
"repository": {
Expand Down
16 changes: 16 additions & 0 deletions scripts/extractLatestChangeLog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const fs = require('fs').promises;
const path = require('path');

const BASE_DIR = path.join(__dirname, '..');
const CHANGELOG_PATH = path.join(BASE_DIR, 'CHANGELOG.md');
const RELEASE_BODY_PATH = path.join(BASE_DIR, 'RELEASE_BODY.md');

(async () => {
try {
const file = await fs.readFile(CHANGELOG_PATH, 'utf8');
const updated = /(#+ \[\d+\.\d+\.\d+].*?)#+ \[?\d+\.\d+\.\d+]?/s.exec(file);
await fs.writeFile(RELEASE_BODY_PATH, updated[1]);
} catch (error) {
console.error(error);
}
})();