-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
825fd5a
commit 83c5bd0
Showing
7 changed files
with
59 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -56,7 +56,7 @@ runs: | |
tool: [email protected] | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
if: inputs.cache == 'true' | ||
if: inputs.cache == 'true' || github.event_name != 'release' || github.event_name != 'workflow_dispatch' | ||
with: | ||
cache-on-failure: true | ||
shared-key: "workspace-${{ inputs.target }}" | ||
|
@@ -67,12 +67,12 @@ runs: | |
. -> target | ||
- name: Run sccache-cache only on non-release runs | ||
if: inputs.cache == 'true' && github.event_name != 'release' && github.event_name != 'workflow_dispatch' | ||
if: inputs.cache == 'true' || github.event_name != 'release' || github.event_name != 'workflow_dispatch' | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Set Rust caching env vars only on non-release runs | ||
shell: sh | ||
if: inputs.cache == 'true' && github.event_name != 'release' && github.event_name != 'workflow_dispatch' | ||
if: inputs.cache == 'true' || github.event_name != 'release' || github.event_name != 'workflow_dispatch' | ||
run: |- | ||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | ||
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV |
This file contains 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,13 +1,17 @@ | ||
name: Publish on Crates.io | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Version to release" | ||
required: true | ||
type: string | ||
|
||
env: | ||
CI: true | ||
RUST_VERSION: 1.81.0 | ||
RUST_NIGHTLY_VERSION: nightly-2024-11-06 | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
|
@@ -22,13 +26,46 @@ jobs: | |
name: Publish on Crates.io | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Check Cargo.toml version | ||
id: check-version | ||
run: | | ||
CURRENT_VERSION=$(grep -m1 '^version =' Cargo.toml | cut -d '"' -f2) | ||
if [ "$CURRENT_VERSION" == "${{ inputs.version }}" ]; then | ||
echo "skip_steps=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "skip_steps=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Configure Git | ||
if: ${{ inputs.version != '' && steps.check-version.outputs.skip_steps == 'false' }} | ||
run: | | ||
git config --global user.name GitHub Actions | ||
git config user.email [email protected] | ||
- name: Install Rust | ||
uses: ./.github/actions/setup-rust | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ env.RUST_VERSION }} | ||
toolchain: ${{ steps.check-version.outputs.skip_steps == 'false' && env.RUST_NIGHTLY_VERSION || env.RUST_VERSION }} | ||
target: x86_64-unknown-linux-gnu,wasm32-unknown-unknown | ||
components: clippy, rustfmt | ||
|
||
- name: Setup Node && PNPM | ||
if: ${{ inputs.version != '' && steps.check-version.outputs.skip_steps == 'false' }} | ||
uses: ./.github/actions/setup-node | ||
|
||
- name: Bump Version | ||
if: ${{ inputs.version != '' && steps.check-version.outputs.skip_steps == 'false' }} | ||
run: | | ||
make bump-version VERSION=${{ inputs.version }} | ||
git add . | ||
git commit -m "Bump version to v${{ inputs.version }}" | ||
git push | ||
- name: Publish Crate | ||
uses: katyo/publish-crates@v2 | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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