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
56 changes: 56 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: release-please

# Keeps one open release pull request that collects the Conventional Commits
# merged since the last release into CHANGELOG.md and picks the next version.
# Merging it pushes the vX.Y.Z tag and a draft GitHub release; the tag starts
# release.yml, which publishes the gem to RubyGems.org and then publishes
# the GitHub release.
#
# Needs the organization's release bot GitHub App, because tags and pull
# requests made with the workflow's own GITHUB_TOKEN do not start other
# workflows:
# variable RELEASE_BOT_APP_ID (or RELEASE_BOT_CLIENT_ID) and
# secret RELEASE_BOT_PRIVATE_KEY.
"on":
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: release-please
cancel-in-progress: false

jobs:
release-please:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check the release bot is set up
id: bot
env:
APP_ID: ${{ vars.RELEASE_BOT_APP_ID }}
CLIENT_ID: ${{ vars.RELEASE_BOT_CLIENT_ID }}
HAS_KEY: ${{ secrets.RELEASE_BOT_PRIVATE_KEY != '' }}
run: |
if { [ -n "${APP_ID}" ] || [ -n "${CLIENT_ID}" ]; } && [ "${HAS_KEY}" = "true" ]; then
echo "ready=true" >> "$GITHUB_OUTPUT"
else
echo "::warning title=release-please skipped::Set the variable RELEASE_BOT_APP_ID and secret RELEASE_BOT_PRIVATE_KEY (see CONTRIBUTING.md, Releases)."
echo "ready=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
if: steps.bot.outputs.ready == 'true'
id: app
with:
# GitHub accepts either the App ID or the Client ID here.
client-id: ${{ vars.RELEASE_BOT_CLIENT_ID || vars.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
if: steps.bot.outputs.ready == 'true'
with:
token: ${{ steps.app.outputs.token }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{".":"0.1.0"}
17 changes: 12 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ Please report security problems privately as described in [SECURITY.md](SECURITY

## Releases

Push a `vX.Y.Z` tag that matches `KnifeNoderings::VERSION` (or merge the
release-please pull request once that workflow is in place). The tag starts
`.github/workflows/release.yml`, which publishes the gem to
[RubyGems.org](https://rubygems.org/gems/knife-noderings) with trusted
publishing and then publishes the GitHub release.
1. Merge pull requests into `main`. release-please
(`.github/workflows/release-please.yml`, using the noderings-release-bot GitHub App)
keeps a pull request named `chore: release X.Y.Z` up to date. It changes
the version in `lib/knife-noderings/version.rb` and writes `CHANGELOG.md`.
2. Merge that pull request when you want to release. release-please pushes the tag
`vX.Y.Z` and creates a draft GitHub release.
3. The tag starts `.github/workflows/release.yml`, which publishes the gem to
[RubyGems.org](https://rubygems.org/gems/knife-noderings) with trusted
publishing, then publishes the GitHub release.

Do not create tags or releases by hand. A gem version on RubyGems.org cannot be
replaced, so only merge the release pull request when you mean to publish.

The first push of a new gem must pass the RubyGems.org account ID (`owner: "256963"`)
when exchanging the OIDC token, as already set in `release.yml`. To retry a
Expand Down
2 changes: 1 addition & 1 deletion lib/knife-noderings/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
#

module KnifeNoderings
VERSION = "0.1.0"
VERSION = "0.1.0" # x-release-please-version
end
70 changes: 70 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"release-type": "simple",
"include-v-in-tag": true,
"include-component-in-tag": false,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"draft": true,
"force-tag-creation": true,
"pull-request-title-pattern": "chore: release ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "refactor",
"section": "Other",
"hidden": true
},
{
"type": "chore",
"section": "Other",
"hidden": true
},
{
"type": "ci",
"section": "Other",
"hidden": true
},
{
"type": "test",
"section": "Other",
"hidden": true
},
{
"type": "build",
"section": "Other",
"hidden": true
}
],
"packages": {
".": {
"package-name": "knife-noderings",
"changelog-path": "CHANGELOG.md",
"extra-files": [
{
"type": "generic",
"path": "lib/knife-noderings/version.rb"
}
]
}
}
}