Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: generate release notes #632

Merged
merged 2 commits into from Nov 23, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/bump-schedules.yml
@@ -0,0 +1,12 @@
name: Bump version (cron)

on:
schedule:
- cron: "15 3 * * TUE"

jobs:
scheduled_bump:
uses: ./.github/workflows/bump.yml
secrets: inherit
with:
semver: minor
71 changes: 71 additions & 0 deletions .github/workflows/bump.yml
@@ -0,0 +1,71 @@
name: Bump version

on:
workflow_dispatch:
inputs:
semver:
description: "Which SemVer"
required: true
default: "patch"
type: choice
options:
- major
- minor
- patch
workflow_call:
inputs:
semver:
description: The image_name to build for.
required: true
type: string
jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- run: npm version ${{ inputs.semver }} --no-git-tag-version --workspaces

- name: generate new version and save to env variable
id: get_version
run: |
echo "NEW_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_OUTPUT

- name: Generate release notes
uses: actions/github-script@v7
id: get_release_note
env:
NEW_VERSION: ${{steps.get_version.outputs.NEW_VERSION}}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const notes = await github.rest.repos.generateReleaseNotes(
{
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${process.env.NEW_VERSION}`,
}
);
return notes.data.body;

- run: |
cat << EOF >> new
## v${{ steps.get_version.outputs.NEW_VERSION }} ($(date '+%Y-%m-%d'))
${{ steps.get_release_note.outputs.result }}
EOF
- run: cat new ./CHANGELOG.md > temp
- run: mv temp ./CHANGELOG.md
- run: rm new

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
base: main
branch: release-${{ steps.get_version.outputs.NEW_VERSION }}
token: ${{secrets.GITHUB_TOKEN}}
commit-message: "bump: v${{ steps.get_version.outputs.NEW_VERSION }}"
body: ${{ steps.get_release_note.outputs.result }}
title: "chore: bump v${{ steps.get_version.outputs.NEW_VERSION }}"
draft: true
milestone: "v${{ steps.get_version.outputs.NEW_VERSION }}"
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Expand Up @@ -31,3 +31,5 @@ jobs:
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: run-$
4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

3 changes: 0 additions & 3 deletions commitlint.config.js

This file was deleted.