-
-
Notifications
You must be signed in to change notification settings - Fork 2
Ci/release prep #2356
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
Merged
Merged
Ci/release prep #2356
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| name: release-prep | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| crate: | ||
| description: "Target crate to bump (exclude fuzz)" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - all | ||
| - portable-network-archive | ||
| - pna | ||
| - libpna | ||
| default: portable-network-archive | ||
| level: | ||
| description: "Version level" | ||
| required: true | ||
| type: choice | ||
| options: [major, minor, patch] | ||
| default: patch | ||
| dependent_version: | ||
| description: "Update dependent versions?" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - fix # Upgrade only when previous requirement no longer matches | ||
| - upgrade # Always upgrade dependents | ||
| default: fix | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| prepare: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 | ||
| with: | ||
| toolchain: stable | ||
|
|
||
| - name: Install cargo-release | ||
| run: cargo install -f --git https://github.com/ChanTsune/cargo-release --branch workspace-enable-template-render-when-single-crate | ||
|
|
||
| - name: Compute next version and build temp release config | ||
| id: prep | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| CRATE="${{ inputs.crate }}" | ||
| LEVEL="${{ inputs.level }}" | ||
|
|
||
| CONFIG=/tmp/release-config.toml | ||
|
|
||
| if [ "$LEVEL" = "patch" ]; then | ||
| COMMIT_MSG=':bookmark: Bump {{crate_name}} version to {{version}}' | ||
| else | ||
| COMMIT_MSG=':bookmark: Bump version to {{version}}' | ||
| fi | ||
|
|
||
| printf 'pre-release-commit-message = "%s"\n' "$COMMIT_MSG" > "$CONFIG" | ||
| echo "config=$CONFIG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Run cargo release (no tag/push) | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| run: | | ||
| set -euo pipefail | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| CRATE="${{ inputs.crate }}" | ||
| DEP_FLAG="--dependent-version ${{ inputs.dependent_version }}" | ||
| EXCLUDES="--exclude portable-network-archive-fuzz" | ||
| if [ "$CRATE" = "all" ]; then | ||
| PKG_FLAG="" | ||
| else | ||
| PKG_FLAG="-p $CRATE" | ||
| fi | ||
|
|
||
| cargo release \ | ||
| ${{ inputs.level }} \ | ||
| $PKG_FLAG \ | ||
| --no-publish \ | ||
| --no-push \ | ||
| --no-tag \ | ||
| --execute \ | ||
| --no-confirm \ | ||
| $EXCLUDES \ | ||
| $DEP_FLAG \ | ||
| --config "${{ steps.prep.outputs.config }}" | ||
|
|
||
| - name: Set PR branch name | ||
| id: branch | ||
| run: | | ||
| BRANCH="release/${{ inputs.crate }}/${{ inputs.level }}-${{ steps.prep.outputs.new_version }}" | ||
| echo "name=$BRANCH" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Create draft PR | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| branch: ${{ steps.branch.outputs.name }} | ||
| title: "chore: prepare release ${{ inputs.crate }} ${{ steps.prep.outputs.new_version }}" | ||
| body: | | ||
| Draft: release prep for `${{ inputs.crate }}` (${{ inputs.level }}). | ||
| - Version set to ${{ steps.prep.outputs.new_version }} | ||
| - Dependent versions: ${{ inputs.dependent_version }} | ||
| - No tags or publishes; cargo-release performed pre-replacements. | ||
| draft: true | ||
| commit-message: "chore: prepare release ${{ inputs.crate }} ${{ steps.prep.outputs.new_version }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| tag-name = "{{crate_name}}-{{version}}" | ||
| pre-release-commit-message = ":bookmark: Bump {{crate_name}} version to {{version}}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.