Skip to content

Commit

Permalink
Document how releases are done in the readme
Browse files Browse the repository at this point in the history
Also create separate release PR and release workflows
  • Loading branch information
spencewenski committed May 6, 2024
1 parent 8bbda24 commit 9b8b957
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 12 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# https://release-plz.ieni.dev/docs/github/quickstart#example-release-pr-and-release
# We use a separate workflow to release vs create a release PR -- this is because we (currently) only want to
# create a release PR after the `Feature Powerset` workflow completes, but we want to publish any merged release
# commits once they're merged to `main`.

name: Release

Expand All @@ -7,20 +10,14 @@ permissions:
contents: write

on:
workflow_run:
# Releases are performed after the `Feature Powerset` workflow completes successfully. Currently, `Feature Powerset`
# runs once a week, so releases will also be performed once a week.
workflows: [ Feature Powerset ]
types:
- completed
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -30,11 +27,8 @@ jobs:
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: MarcoIeni/[email protected]
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
on-powerset-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The `Feature Powerset` workflow failed, skipping release.'
40 changes: 40 additions & 0 deletions .github/workflows/release_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://release-plz.ieni.dev/docs/github/quickstart#example-release-pr-and-release

name: Release PR

permissions:
pull-requests: write
contents: write

on:
workflow_run:
# Release PRs are created after the `Feature Powerset` workflow completes successfully. Currently,
# `Feature Powerset` runs once a week, so release PRs will also be created once a week.
workflows: [ Feature Powerset ]
types:
- completed

jobs:
release-pr:
name: Release PR
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: MarcoIeni/[email protected]
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
on-powerset-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The `Feature Powerset` workflow failed, skipping release.'
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,23 @@ open target/debug/coverage/index.html
# Delete the *.profraw files generated by the coverage tooling
rm coverage/$USER-*.profraw
```

# Releases

Releases are created and published to crates.io using [release-plz](https://github.com/MarcoIeni/release-plz) via
our [Release PR][ReleasePRLink] and [Release][ReleaseLink] workflows. The [Release PR][ReleasePRLink] workflow runs when
the [Feature Powerset][FeaturePowersetLink] workflow completes successfully. The [Feature Powerset][FeaturePowersetLink]
workflow is scheduled to run once a week, so release PR will also be created once a week. If an unscheduled release
needs to be created, the [Feature Powerset][FeaturePowersetLink] workflow can also be triggered manually, and
the [Release PR][ReleasePRLink] workflow will run once the [Feature Powerset][FeaturePowersetLink] workflow completes.
Once a release PR is merged to `main`, the [Release][ReleaseLink] workflow will publish the release.

Note that we use the default `GITHUB_TOKEN` to create the release PRs. This means that the PR checks [will not
run automatically](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow).
To get the checks to run, simply close and re-open the release PR.

[ReleaseLink]: https://github.com/roadster-rs/roadster/blob/main/.github/workflows/release.yml

[ReleasePRLink]: https://github.com/roadster-rs/roadster/blob/main/.github/workflows/release_pr.yml

[FeaturePowersetLink]: https://github.com/roadster-rs/roadster/blob/main/.github/workflows/feature_powerset.yml

0 comments on commit 9b8b957

Please sign in to comment.