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

# Needs permissions as specified in:
# https://release-plz.ieni.dev/docs/github/quickstart
permissions:
pull-requests: write
contents: write

on:
workflow_dispatch:

jobs:
new-release:
name: Prepare new release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
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: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish release

# Needs permissions as specified in:
# https://release-plz.ieni.dev/docs/github/quickstart
permissions:
contents: write

on:
push:
tags:
- "v*"

jobs:
publish:
name: Publish release
runs-on: ubuntu-latest
permissions:
contents: write
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: release-plz/action@v0.5
with:
command: release
env:
# Needs permissions as specified in:
# https://release-plz.ieni.dev/docs/github/quickstart#1-change-github-actions-permissions
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Needs permissions as specified in:
# https://release-plz.ieni.dev/docs/github/quickstart#2-set-the-cargo_registry_token-secret
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment here, clarifying the permissions the token should have? I'm thinking we will probably be copying this code to more repos in the future, so it could be helpful to specify the requirement here.
In my opinion that would be:

  • the token should only allow updates, not publishing new crates or yanking.
  • Ideally it would be scoped to the crate, although that wouldn't work with workspaces.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want publish if we introduce new crates. release plz suggest: https://release-plz.ieni.dev/docs/github/quickstart#2-set-the-cargo_registry_token-secret

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Publishing new crates shouldn't happen very often, so I feel like it would be fine to have a human due to that when necessary.
on the other hand, it doesn't matter too much from a security perspective, since permissions to update a crate (that is potentially used by many others) is more valuable than permissions to publish a new crate (which would be unused by default).
I guess in any case we would need to make sure that we monitor the crates.io notification emails for suspicious activity.

4 changes: 4 additions & 0 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[workspace]
# we trigger publish by creating tag
# so we can assume it's already created
git_tag_enable = false