Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: automate creation of GitHub releases and tags #235

Closed
wants to merge 6 commits into from
Closed
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
32 changes: 32 additions & 0 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release Checker

on:
pull_request_target:
paths:
- "**/Cargo.toml"
types: [ opened, synchronize, reopened, labeled, unlabeled ]
workflow_dispatch:

permissions:
contents: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-check:
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected]
with:
sources: |
galargh marked this conversation as resolved.
Show resolved Hide resolved
[
"frc42_dispatch/Cargo.toml",
"frc42_dispatch/hasher/Cargo.toml",
"frc42_dispatch/macros/Cargo.toml",
"frc46_token/Cargo.toml",
"frc53_nft/Cargo.toml",
"fvm_actor_utils/Cargo.toml",
"fvm_dispatch_tools/Cargo.toml"
]
separator: "@"
32 changes: 32 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Releaser

on:
push:
paths:
- "**/Cargo.toml"
workflow_dispatch:

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true

jobs:
releaser:
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected]
with:
sources: |
[
"frc42_dispatch/Cargo.toml",
"frc42_dispatch/hasher/Cargo.toml",
"frc42_dispatch/macros/Cargo.toml",
"frc46_token/Cargo.toml",
"frc53_nft/Cargo.toml",
"fvm_actor_utils/Cargo.toml",
"fvm_dispatch_tools/Cargo.toml"
]
separator: "@"
secrets:
UCI_GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Release Process

This document describes the process for releasing a new version of the `actors-utils` project.

## Current State

1. Create a pull request which updates the [`version` in one or more `Cargo.toml` files](https://github.com/search?q=repo%3Afilecoin-project%2Factors-utils+path%3ACargo.toml+%2F%5Eversion+%3D%2F&type=code).
- Title the PR `chore: release Ɑ for Ƅ` where:
- `Ɑ` is what is being released like "all crates"
- `Ƅ` is the cause for the release like "fvm vX.Y.Z" or "nvXX"
2. On such a release PR's creation, a [Release Checker](.github/workflows/release-check.yml) workflow will run. It will perform the following actions:
1. Extract the version from the modified `Cargo.toml` files, and process each crate in the workspace **independently**.
2. Check if a git tag for the version, using the `crate_name@version` as the pattern, already exists, and continue only if it does not.
3. Create a draft GitHub release with the version as the tag.
4. Comment on the pull request with a link to the draft release.
2. **[MANUAL]** Run `cargo publish --dry-run` for each crate that is proposed to be released in the reverse dependency order.
Copy link
Member

Choose a reason for hiding this comment

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

How does someone find the reverse dependency order?

Copy link
Member

Choose a reason for hiding this comment

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

And how does this get done for the crate? we have a workspace here so do we need to -p to do this or do we cd into the directory to run this? I'm not clear on how publishing on workspaces works so this is a bit of a mystery to me.

3. On pull request merge, a [Releaser](.github/workflows/release.yml) workflow will run. It will perform the following actions:
1. Extract the version from the modified `Cargo.toml` files, and process each crate in the workspace **independently**.
2. Check if a git tag for the version, using the `crate_name@version` as the pattern, already exists, and continue only if it does not.
3. Check if a draft GitHub release with the version as the tag exists.
4. If the draft release exists, publish it. Otherwise, create a new release with the version as the tag.
4. **[MANUAL]** Run `cargo publish` for each crate that has been released in the reverse dependency order.
galargh marked this conversation as resolved.
Show resolved Hide resolved
- You will need to be part of [fvm-create-owners](https://github.com/orgs/filecoin-project/teams/fvm-crate-owners) to do this per https://crates.io/crates/fvm_actor_utils .

#### Known Limitations

1. `cargo publish --dry-run` has to be run manually.
2. `cargo publish` has to be run manually.

#### Possible Improvements

1. Run `cargo publish --dry-run` in the reverse dependency order automatically. Use a local registry to simulate the dependencies that are not yet published.
2. Run `cargo publish` in the [**reverse dependency order**](#crate-dependency-graph) automatically after the merge.
Loading