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

on:
push:
branches: [master]
workflow_dispatch: {}

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
release-please:
name: Release Please
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# release-please acts as the organisation's release App, not as
# GITHUB_TOKEN: what GITHUB_TOKEN creates triggers no workflows, so the
# release would not run `gnd-binary-build.yml` (on: release: published)
# and the release PR would get no CI. The App is the organisation's
# release identity, used by the repositories it makes releases for (org
# variable RELEASE_APP_CLIENT_ID, org secret RELEASE_APP_PRIVATE_KEY, both
# granted to selected repositories); the token is limited to this
# repository and to what release-please needs.
- name: Mint app token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
with:
client-id: ${{ vars.RELEASE_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
permission-contents: write
permission-pull-requests: write
permission-issues: write

- name: Run release-please
id: release
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5
with:
token: ${{ steps.app-token.outputs.token }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

- name: Summarise
env:
RELEASE_CREATED: ${{ steps.release.outputs.release_created }}
TAG_NAME: ${{ steps.release.outputs.tag_name }}
PRS_CREATED: ${{ steps.release.outputs.prs_created }}
run: |
if [ "$RELEASE_CREATED" = "true" ]; then
echo "Released $TAG_NAME" >> "$GITHUB_STEP_SUMMARY"
elif [ "$PRS_CREATED" = "true" ]; then
echo "Release PR created/updated" >> "$GITHUB_STEP_SUMMARY"
else
echo "Nothing to release" >> "$GITHUB_STEP_SUMMARY"
fi
40 changes: 40 additions & 0 deletions .github/workflows/semantic-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Semantic PR

# pull_request, not pull_request_target: the check only reads the title, so
# a fork's read-only token is enough, and the repository keeps no
# pull_request_target job (a condition of running on forge's public runners).
on:
pull_request:
types: [opened, edited, synchronize, reopened]

permissions:
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
title:
name: Conventional PR title
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
# Squash-merge uses the PR title as the commit message, so linting the
# title is what keeps master's history conventional for release-please.
# The scope is the crate, e.g. `feat(store): ...`.
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
docs
test
refactor
perf
build
ci
chore
revert
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.45.0"
}
11 changes: 7 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,14 @@ Blockchain → Chain Adapter → Block Stream → Trigger Processing → Runtime

### Commit Convention

Use format: `{crate-name}: {description}`
Use [Conventional Commits](https://www.conventionalcommits.org) with the crate as scope: `{type}({crate-name}): {description}`

- Single crate: `store: Support 'Or' filters`
- Multiple crates: `core, graphql: Add event source to store`
- All crates: `all: {description}`
- Single crate: `feat(store): Support 'Or' filters`
- Multiple crates: `feat(core,graphql): Add event source to store`
- All crates: `refactor(all): {description}`
- Types: `feat`, `fix`, `docs`, `test`, `refactor`, `perf`, `build`, `ci`, `chore`, `revert`; mark breaking changes with `!` (`feat(store)!: ...`)

Pull requests are squash-merged, so the PR title becomes the commit on master; the Semantic PR workflow checks it. release-please derives versions and the changelog from these commits: while the version is below 1.0, `feat` and breaking changes bump the minor version, `fix` and `perf` bump the patch version. Commits inside a PR use the same format.

### Git Workflow

Expand Down
86 changes: 48 additions & 38 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,47 +50,57 @@ detailed instructions about how to run the sharded integrations tests.

## Commit messages and pull requests

We use the following format for commit messages:
`{crate-name}: {Brief description of changes}`, for example: `store: Support 'Or' filters`.

If multiple crates are being changed list them all like this: `core,
graphql: Add event source to store` If all (or most) crates are affected
by the commit, start the message with `all: `.

The body of the message can be terse, with just enough information to
explain what the commit does overall. In a lot of cases, more extensive
explanations of _how_ the commit achieves its goal are better as comments
in the code.

Commits in a pull request should be structured in such a way that each
commit consists of a small logical step towards the overall goal of the
pull request. Your pull request should make it as easy as possible for the
reviewer to follow each change you are making. For example, it is a good
idea to separate simple mechanical changes like renaming a method that
touches many files from logic changes. Your pull request should not be
structured into commits according to how you implemented your feature,
often indicated by commit messages like 'Fix problem' or 'Cleanup'. Flex a
bit, and make the world think that you implemented your feature perfectly,
in small logical steps, in one sitting without ever having to touch up
something you did earlier in the pull request. (In reality, that means
you'll use `git rebase -i` a lot)
Pull requests are squash-merged: the pull request's title becomes the
commit on master, and its description the commit body. release-please
derives versions and the changelog from those commits, so the title must
follow [Conventional Commits](https://www.conventionalcommits.org) with
the crate as scope: `{type}({crate-name}): {Brief description of changes}`,
for example: `feat(store): Support 'Or' filters`. The types are `feat`,
`fix`, `docs`, `test`, `refactor`, `perf`, `build`, `ci`, `chore` and
`revert`; mark breaking changes with `!` (`feat(store)!: ...`). The
Semantic PR check verifies the title.

If multiple crates are being changed list them all like this:
`feat(core,graphql): Add event source to store`. If all (or most) crates
are affected by the commit, use the scope `all`.

Only `feat`, `fix`, `perf` and breaking changes appear in the changelog;
while the version is below 1.0, `feat` and breaking changes bump the
minor version, `fix` and `perf` the patch version.

The description can be terse, with just enough information to explain
what the change does overall. In a lot of cases, more extensive
explanations of _how_ it achieves its goal are better as comments in the
code.

Commits in a pull request should still be structured in such a way that
each commit consists of a small logical step towards the overall goal of
the pull request, so that the reviewer can follow each change you are
making. For example, it is a good idea to separate simple mechanical
changes like renaming a method that touches many files from logic changes.

Please do not merge master into your branch as you develop your pull
request; instead, rebase your branch on top of the latest master if your
pull request branch is long-lived.

We try to keep the history of the `master` branch linear, and avoid merge
commits. Once your pull request is approved, merge it following these
steps:
```
git checkout master
git pull master
git rebase master my/branch
git push -f
git checkout master
git merge my/branch
git push
```
Once your pull request is approved, merge it with the `Squash and merge`
button, checking that the title is the commit message you want on master.
Changes reach master only through pull requests.

## Releases

release-please keeps a release pull request open, `chore(master): release
X.Y.Z`, that bumps the version in `Cargo.toml` and `Cargo.lock` and adds
the changes since the last release to `CHANGELOG.md`. To release:

1. Add the release's notes to `NEWS.md` in a pull request of its own and
merge it. (Don't edit the release pull request: release-please
rewrites it on every push to master.)
2. Merge the release pull request. release-please tags `vX.Y.Z` and
creates the GitHub release, which publishes the graph-node binaries
and Docker images (`release.yml`) and the gnd binaries and npm
packages (`gnd-binary-build.yml`).

Allegedly, clicking on the `Rebase and merge` button in the Github UI has
the same effect.
To release a version other than the one release-please proposes, put
`Release-As: X.Y.Z` in the body of a commit on master (for example in the
squash-merge description of a pull request).
25 changes: 25 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"bootstrap-sha": "8e3debd675309d96eb987bf90f053f378bc917bf",
"last-release-sha": "8e3debd675309d96eb987bf90f053f378bc917bf",
"bump-minor-pre-major": true,
"include-component-in-tag": false,
"packages": {
".": {
"release-type": "simple",
"changelog-path": "CHANGELOG.md",
"extra-files": [
{
"type": "toml",
"path": "Cargo.toml",
"jsonpath": "$.workspace.package.version"
},
{
"type": "toml",
"path": "Cargo.lock",
"jsonpath": "$.package[?(!@.source)].version"
}
]
}
}
}
Loading