diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1dcc3baf..12323eb3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -7,12 +10,7 @@ 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 @@ -20,7 +18,6 @@ jobs: release: name: Release runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -30,11 +27,8 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Run release-plz uses: MarcoIeni/release-plz-action@v0.5 + 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.' diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml new file mode 100644 index 00000000..9abe3fce --- /dev/null +++ b/.github/workflows/release_pr.yml @@ -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/release-plz-action@v0.5 + 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.' diff --git a/README.md b/README.md index 77f4da71..3eaafa04 100644 --- a/README.md +++ b/README.md @@ -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