Skip to content

Commit

Permalink
ci(repo): Adjust publish crates to run with workflow dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Jan 24, 2025
1 parent 825fd5a commit 0818406
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 8 deletions.
47 changes: 42 additions & 5 deletions .github/workflows/publish_release.yaml
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 }}
Expand All @@ -22,14 +26,47 @@ 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
with:
toolchain: ${{ env.RUST_VERSION }}
cache: false
toolchain: ${{ env.RUST_NIGHTLY_VERSION }}
target: x86_64-unknown-linux-gnu,wasm32-unknown-unknown

- 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
id: publish-crates
Expand Down
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ sqlx = { version = "0.8.3", default-features = false, features = [
"tls-native-tls",
"macros",
] }
netlink-proto = { version = "=0.11.3" }

fuel-data-parser = { version = "0.0.18", path = "crates/fuel-data-parser" }
fuel-message-broker = { version = "0.0.18", path = "crates/fuel-message-broker" }
Expand All @@ -98,9 +99,6 @@ sv-webserver = { version = "0.0.18", path = "crates/sv-webserver" }
[workspace.metadata.cargo-machete]
ignored = ["fuel-core", "tokio", "anyhow"]

[workspace.metadata.workspaces]
netlink-proto = { version = "=0.11.3" }

[profile.release]
opt-level = 3
lto = "thin"
Expand Down

0 comments on commit 0818406

Please sign in to comment.