-
Notifications
You must be signed in to change notification settings - Fork 1
chore(release): prepare v0.1.0 #14
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
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 |
|---|---|---|
| @@ -1,100 +1,53 @@ | ||
| name: Publish to crates.io | ||
| name: Publish | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| dry_run: | ||
| description: 'Dry run (no actual publish)' | ||
| required: false | ||
| default: 'true' | ||
| type: boolean | ||
| crate: | ||
| description: 'Crate to publish (all, fetchkit, fetchkit-cli)' | ||
| required: false | ||
| default: 'all' | ||
| type: choice | ||
| options: | ||
| - all | ||
| - fetchkit | ||
| - fetchkit-cli | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_BACKTRACE: 1 | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test before publish | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - name: Run tests | ||
| run: cargo test --workspace | ||
| - name: Check formatting | ||
| run: cargo fmt --all -- --check | ||
| - name: Clippy | ||
| run: cargo clippy --workspace --all-targets -- -D warnings | ||
|
|
||
| publish-fetchkit: | ||
| name: Publish fetchkit | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| if: >- | ||
| github.event_name == 'release' || | ||
| (github.event_name == 'workflow_dispatch' && | ||
| (github.event.inputs.crate == 'all' || github.event.inputs.crate == 'fetchkit')) | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Verify crate can be packaged | ||
| run: cargo package -p fetchkit --allow-dirty | ||
|
|
||
| - name: Publish fetchkit (dry run) | ||
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' | ||
| run: cargo publish -p fetchkit --dry-run | ||
|
|
||
| - name: Publish fetchkit | ||
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') | ||
| - name: Verify version matches tag | ||
| run: | | ||
| TAG_VERSION="${{ github.event.release.tag_name }}" | ||
| if [ -n "$TAG_VERSION" ]; then | ||
| TAG_VERSION="${TAG_VERSION#v}" | ||
| CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | ||
| if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then | ||
| echo "Error: Tag version does not match Cargo.toml version" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| - name: Publish fetchkit to crates.io | ||
| run: cargo publish -p fetchkit | ||
| env: | ||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
|
|
||
| publish-fetchkit-cli: | ||
| name: Publish fetchkit-cli | ||
| needs: [test, publish-fetchkit] | ||
| runs-on: ubuntu-latest | ||
| if: >- | ||
| github.event_name == 'release' || | ||
| (github.event_name == 'workflow_dispatch' && | ||
| (github.event.inputs.crate == 'all' || github.event.inputs.crate == 'fetchkit-cli')) | ||
| needs: publish-fetchkit | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| # Wait for crates.io index to update after fetchkit publish | ||
| - name: Wait for crates.io index | ||
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') | ||
| - name: Wait for crates.io index update | ||
| run: sleep 30 | ||
|
|
||
| - name: Verify crate can be packaged | ||
| run: cargo package -p fetchkit-cli --allow-dirty | ||
|
|
||
| - name: Publish fetchkit-cli (dry run) | ||
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true' | ||
| run: cargo publish -p fetchkit-cli --dry-run | ||
|
|
||
| - name: Publish fetchkit-cli | ||
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'false') | ||
| - name: Publish fetchkit-cli to crates.io | ||
| run: cargo publish -p fetchkit-cli | ||
| env: | ||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
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
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
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release.ymldispatches publish withgh workflow run publish.ymlbut does not pass any release tag/ref context, sopublish.ymlruns asworkflow_dispatchandgithub.event.release.tag_nameis empty, which skips the version guard inVerify version matches tag. That means publish is no longer cryptographically tied to the release artifact and can publish whatever revision/version the dispatch resolves to (for example on reruns or branch movement), defeating the intended tag-version safety check.Useful? React with 👍 / 👎.