chore(deps): update rust crate clap to 4.5.0 (#162) #469
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
name: CI/CD | |
on: | |
push: | |
paths-ignore: | |
- README.md | |
branches: [main] | |
tags: [v*.*.*] | |
pull_request: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Test | |
run: cargo test -F bin,wasm | |
- name: Lint | |
run: cargo clippy -F bin,wasm | |
version: | |
runs-on: ubuntu-latest | |
needs: test | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Compute package version | |
id: version | |
run: echo "version=${GITHUB_REF##refs/tags/v}" >> $GITHUB_OUTPUT | |
build-wasm: | |
runs-on: ubuntu-latest | |
needs: version | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
- name: Install npm packages | |
run: bun install --frozen-lockfile | |
- name: Build wasm | |
run: | | |
bun run build | |
cd pkg/ | |
cp ../.npmrc . | |
npm version --no-git-tag-version '${{ needs.version.outputs.version }}' | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: base-converter-wasm | |
path: pkg/ | |
build: | |
needs: version | |
strategy: | |
max-parallel: 1 | |
matrix: | |
os: [ubuntu-latest, | |
# macos-latest-xlarge | |
] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Override version | |
run: | | |
if "$(uname -s)" = "Darwin"; then | |
SED="sed -i ''" | |
else | |
SED="sed -i" | |
fi | |
$SED -E 's/^version = ".+"$/version = "${{ needs.version.outputs.version }}"/' Cargo.toml | |
- name: Build cross platforms | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
cross build --release --locked --bin base-converter -F bin --target aarch64-unknown-linux-gnu | |
cross build --release --locked --bin base-converter -F bin --target aarch64-unknown-linux-musl | |
cross build --release --locked --bin base-converter -F bin --target x86_64-unknown-linux-gnu | |
cross build --release --locked --bin base-converter -F bin --target x86_64-unknown-linux-musl | |
cross build --release --locked --bin base-converter -F bin --target x86_64-pc-windows-gnu | |
mkdir tmp/ | |
mv ./target/aarch64-unknown-linux-gnu/release/base-converter ./tmp/base-converter-aarch64-unknown-linux-gnu | |
mv ./target/aarch64-unknown-linux-musl/release/base-converter ./tmp/base-converter-aarch64-unknown-linux-musl | |
mv ./target/x86_64-unknown-linux-gnu/release/base-converter ./tmp/base-converter-x86_64-unknown-linux-gnu | |
mv ./target/x86_64-unknown-linux-musl/release/base-converter ./tmp/base-converter-x86_64-unknown-linux-musl | |
mv ./target/x86_64-pc-windows-gnu/release/base-converter.exe ./tmp/base-converter-x86_64-pc-windows-gnu.exe | |
- name: Build macos | |
if: matrix.os == 'macos-latest-xlarge' | |
run: | | |
cargo build --release --locked --bin base-converter -F bin | |
mkdir tmp/ | |
mv ./target/aarch64-apple-darwin/release/base-converter ./tmp/base-converter-aarch64-apple-darwin | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: cli-${{ matrix.os }} | |
path: tmp/ | |
release: | |
runs-on: ubuntu-latest | |
needs: [version, build-wasm, build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist/ | |
- name: Publish on npmjs.com | |
working-directory: dist/base-converter-wasm | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish | |
- name: Publish on crates.io | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: | | |
sed -i -E 's/^version = ".+"$/version = "${{ needs.version.outputs.version }}"/' Cargo.toml | |
cargo publish --allow-dirty --locked | |
- name: Github Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
tag_name: v${{ needs.version.outputs.version }} | |
files: | | |
./dist/cli-*/* | |
body: | | |
# Rust Doc | |
https://docs.rs/base-converter/${{ needs.version.outputs.version }}/base_converter/ | |
# NPM Package | |
https://www.npmjs.com/package/@ctison/base-converter/v/${{ needs.version.outputs.version }} |