From 5f0bc6ea85f00ccba70263cd56c1486412828c9a Mon Sep 17 00:00:00 2001 From: Kevin Eady <8634912+KevinEady@users.noreply.github.com> Date: Tue, 9 Jul 2024 10:32:51 +0200 Subject: [PATCH] chore: add release automation --- .github/workflows/release-please.yml | 33 ++++++++++++++++++++++++++++ .release-please-manifest.json | 3 +++ CREATING_A_RELEASE.md | 14 ++++++++++-- release-please-config.json | 11 ++++++++++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..9eea07e --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,33 @@ +name: release-please + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + + npm-publish: + needs: release-please + if: ${{ needs.release-please.outputs.release_created }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: 'https://registry.npmjs.org' + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..a1961ec --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.1.0" +} diff --git a/CREATING_A_RELEASE.md b/CREATING_A_RELEASE.md index f96aa7f..abc1a37 100644 --- a/CREATING_A_RELEASE.md +++ b/CREATING_A_RELEASE.md @@ -5,7 +5,17 @@ want to be able to do releases ask one of the existing collaborators to add you. If necessary you can ask the build Working Group who manages the Node.js npm user to add you if there are no other active collaborators. -## Prerequisites +Generally, the release is handled by the +[release-please](https://github.com/nodejs/node-api-headers/blob/main/.github/workflows/release-please.yml) +GitHub action. It will bump the version in `package.json` and publish +node-api-headers to npm. + +In cases that the release-please action is not working, please follow the steps +below to publish node-api-headers manually. + +## Publish new release manually + +### Prerequisites Before to start creating a new release check if you have installed the following tools: @@ -15,7 +25,7 @@ tools: If not please follow the instruction reported in the tool's documentation to install it. -## Publish new release +### Steps These are the steps to follow to create a new release: diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..a67f6a4 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "node", + "pull-request-title-pattern": "chore: release v${version}", + "bootstrap-sha": "186e04b5e40e54d7fd1655bc67081cc483f12488", + "packages": { + ".": { + "changelog-path": "CHANGELOG.md" + } + } +}