-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prettier changelog content to reader format. ref: #59
- Loading branch information
1 parent
b5bbe37
commit edd76b4
Showing
4 changed files
with
100 additions
and
234 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,11 +1,7 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- CHANGELOG.md | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run: | ||
|
@@ -14,8 +10,19 @@ jobs: | |
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup package | ||
run: yarn install | ||
|
||
- name: Get version from package | ||
- name: Bump version | ||
run: | | ||
yarn standard-version --skip.commit --skip.tag | ||
sed 's/^### \[/## [/' -i CHANGELOG.md | ||
yarn prettier --write CHANGELOG.md --prose-wrap never --ignore-path ./gitignore | ||
- name: Get version from package.json | ||
uses: actions/[email protected] | ||
id: version | ||
with: | ||
|
@@ -24,29 +31,29 @@ jobs: | |
const version = require(`${process.env.GITHUB_WORKSPACE}/package.json`).version; | ||
core.setOutput('repo', context.repo.repo); | ||
core.setOutput('version', version); | ||
const time = new Date(Date.now()).toISOString().slice(0,10); | ||
const titleLink = version.replace(/\./g,'') + '-' + time; | ||
core.setOutput('titleLink', titleLink); | ||
try { | ||
var latestRelease = await github.repos.getLatestRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
const latestTag = latestRelease.data.tag_name; | ||
core.setOutput('commitLink', `compare/${latestTag}...v${version}`); | ||
} catch (error) { | ||
if (error.message === 'Not Found') { | ||
core.setOutput('commitLink', `commits/v${version}`); | ||
} else { | ||
core.setFailed(error.message); | ||
} | ||
} | ||
return true; | ||
- name: Generate Package | ||
- name: Push commit | ||
run: | | ||
yarn install | ||
yarn run package | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git add . | ||
git commit -m "chore(release): :bookmark: release v${{steps.version.outputs.version}}" | ||
git push https://vivaxy:${{secrets.GITHUB_TOEKN}}@github.com/vivaxy/vscode-conventional-commits.git | ||
- name: Publish package | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} | ||
run: yarn run deploy | ||
|
||
- name: Build release asset | ||
run: yarn run build | ||
|
||
- name: Get Changelog Entry | ||
id: changelog_reader | ||
uses: mindsers/[email protected] | ||
with: | ||
version: ${{steps.version.outputs.version}} | ||
path: ./CHANGELOG.md | ||
|
||
- name: Create release | ||
id: create_release | ||
|
@@ -56,11 +63,10 @@ jobs: | |
with: | ||
tag_name: v${{steps.version.outputs.version}} | ||
release_name: Release v${{steps.version.outputs.version}} | ||
body: | | ||
* Changelogs: | ||
<https://github.com/${{github.repository}}/blob/master/CHANGELOG.md#${{steps.version.outputs.titleLink}}> | ||
* Commits: | ||
<https://github.com/${{github.repository}}/${{steps.version.outputs.commitLink}}> | ||
body: ${{ steps.changelog_reader.outputs.changes }} | ||
prerelease: | ||
${{ steps.changelog_reader.outputs.status == 'prereleased' }} | ||
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} | ||
|
||
- name: Upload release asset | ||
uses: actions/[email protected] | ||
|
Oops, something went wrong.