Skip to content
Open
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
137 changes: 137 additions & 0 deletions .github/workflows/new-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Automated Release Generation

on:
push:
branches:
- master

jobs:
generate-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git Identity
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'

- name: Set Up changelog-maker Config
run: |
# Construct and write out a JSON config file for changelog-maker.
# Allows changelog-maker to authenticate to the GitHub API
mkdir -p ~/.config/changelog-maker
CONFIG_FILE=~/.config/changelog-maker/config.json

echo "{" > "${CONFIG_FILE}"
echo " \"token\": \"${{ secrets.GITHUB_TOKEN }}\"," >> "${CONFIG_FILE}"
echo " \"user\": \"${USER}\"" >> "${CONFIG_FILE}"
echo "}" >> "${CONFIG_FILE}"

# - name: Install Dependencies
# run: npm install -g changelog-maker semver

- name: Update CHANGELOG.md and package.json
shell: bash
run: |
# Uses pinned node dependency versions.
# Feel free to bump these as needed.
CHANGELOG_MAKER_COMMAND="npx --quiet [email protected]"
SEMVER_COMMAND="npx --quiet [email protected]"

echo "CHANGELOG_MAKER_COMMAND is: ${CHANGELOG_MAKER_COMMAND}"
echo "SEMVER_COMMAND is: ${SEMVER_COMMAND}"

STARTING_VERSION=`node -e "console.log(require('./package').version)"`

echo "STARTING_VERSION is: ${STARTING_VERSION}"

if [ `uname -s` = "Darwin" ]; then
# Appropriate flags for macOS/BSD date
TODAYS_DATE=`date -j '+%Y-%m-%d'`
else
# Appropriate flags for Linux/GNU date
TODAYS_DATE=`date -I`
fi

echo "TODAYS_DATE is: ${TODAYS_DATE}"

CHANGELOG_MAKER_SUGGESTED_CHANGELOG=`${CHANGELOG_MAKER_COMMAND} | grep -vi 'bump version and update changelog'`

echo "CHANGELOG_MAKER_SUGGESTED_CHANGELOG is: ${CHANGELOG_MAKER_SUGGESTED_CHANGELOG}"

CL=${CHANGELOG_MAKER_SUGGESTED_CHANGELOG}

if [ -z "${CL}" ]; then
echo "No CHANGELOG entries to add since the last release. Exiting."
exit
fi

# echo "CL is: ${CL}"

if echo ${CL} | grep -F '**(SEMVER-MAJOR)**'; then
VERSION_BUMP_LEVEL="major"
elif echo ${CL} | grep -F '**(SEMVER-MINOR)**'; then
VERSION_BUMP_LEVEL="minor"
else
VERSION_BUMP_LEVEL="patch"
fi

echo "VERSION_BUMP_LEVEL is: ${VERSION_BUMP_LEVEL}"

NEXT_VERSION=`${SEMVER_COMMAND} -i "${VERSION_BUMP_LEVEL}" "${STARTING_VERSION}"`

echo "NEXT_VERSION is: ${NEXT_VERSION}"

HEADER1="v${NEXT_VERSION} ${TODAYS_DATE}"
HEADER2="================="

echo "HEADER1 is: ${HEADER1}"
echo "HEADER2 is: ${HEADER2}"

FILENAME="new_changelog.md"

echo "FILENAME is: ${FILENAME}"

echo "${HEADER1}" > "${FILENAME}"
echo "${HEADER2}" >> "${FILENAME}"
echo >> "${FILENAME}"
echo "${CL}" >> "${FILENAME}"
echo >> "${FILENAME}"
cat CHANGELOG.md >> "${FILENAME}"

echo "Updated changelog looks like this:"
cat "${FILENAME}"

echo "Incrementing version"

npm version "${NEXT_VERSION}"

echo "Git-adding updated changelog, amending commit"

mv "${FILENAME}" CHANGELOG.md

git add CHANGELOG.md

git commit --amend --no-edit -m "v${NEXT_VERSION}: bump version and update changelog"

echo "DONE UPDATING \`CHANGELOG.md\` AND \`package.json\`, DONE COMMITTING!"

- name: Create or Update Pull Request
# Pin to an exact commit matching peter-evans/[email protected]
# Feel free to update to a newer version later, but tags are mutable,
# and pinning to a specific commit is a stronger guarantee of no tampering.
uses: peter-evans/create-pull-request@052fc72b4198ba9fbc81b818c6e1859f747d49a8
with:
base: master
branch: release-next-automated
title: Release Proposal
body: |
This is an automated release proposal.

See the changed files (particularly CHANGELOG.md) for details.

This was created by '.github/workflows/new-workflow.yml'
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
v8.0.1 2021-05-09
=================

* [[`9fbccb181d`](https://github.com/nodejs/node-gyp/commit/9fbccb181d)] - **ci**: try the other way again to configure changelog-maker (DeeDeeG)
* [[`b810545bf9`](https://github.com/nodejs/node-gyp/commit/b810545bf9)] - **ci**: use changelog-maker v2, not v7 (DeeDeeG)
* [[`5967d8a77a`](https://github.com/nodejs/node-gyp/commit/5967d8a77a)] - **ci**: try another way to configure changelog-maker (DeeDeeG)
* [[`535cdea821`](https://github.com/nodejs/node-gyp/commit/535cdea821)] - **ci**: add forgotten comma (DeeDeeG)
* [[`71cbc201b6`](https://github.com/nodejs/node-gyp/commit/71cbc201b6)] - **ci**: use double-quotes, per the JSON spec (DeeDeeG)
* [[`0b227befaa`](https://github.com/nodejs/node-gyp/commit/0b227befaa)] - **ci**: use correct/less-confusing quotation (DeeDeeG)
* [[`dae5ea98dc`](https://github.com/nodejs/node-gyp/commit/dae5ea98dc)] - **ci**: avoid quoting "\~/" so that it will be expanded (DeeDeeG)
* [[`48c1e1b4db`](https://github.com/nodejs/node-gyp/commit/48c1e1b4db)] - **ci**: make \~/.config/changelog-maker (DeeDeeG)
* [[`28ce909643`](https://github.com/nodejs/node-gyp/commit/28ce909643)] - **ci**: set up the config file for changelog-maker (DeeDeeG)
* [[`dcc03708a0`](https://github.com/nodejs/node-gyp/commit/dcc03708a0)] - **ci**: configure git identity (DeeDeeG)
* [[`387ab2b7a7`](https://github.com/nodejs/node-gyp/commit/387ab2b7a7)] - **ci**: use fetch-depth 0 for checkout action (DeeDeeG)
* [[`439674ebf8`](https://github.com/nodejs/node-gyp/commit/439674ebf8)] - **ci**: remove incorrect quoting (DeeDeeG)
* [[`8ee132f1ee`](https://github.com/nodejs/node-gyp/commit/8ee132f1ee)] - **ci**: use npx to run node module commands (DeeDeeG)
* [[`e9afca5ec9`](https://github.com/nodejs/node-gyp/commit/e9afca5ec9)] - **ci**: add a new workflow for automated release PRs (DeeDeeG)
* [[`4b83c3de73`](https://github.com/nodejs/node-gyp/commit/4b83c3de73)] - **doc**: fix v8.0.0 release date (Rod Vagg) [#2346](https://github.com/nodejs/node-gyp/pull/2346)

v8.0.0 2021-04-03
=================

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bindings",
"gyp"
],
"version": "8.0.0",
"version": "8.0.1",
"installVersion": 9,
"author": "Nathan Rajlich <[email protected]> (http://tootallnate.net)",
"repository": {
Expand Down