Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
140 lines
3.4 KiB
YAML
140 lines
3.4 KiB
YAML
name: Check & publish
|
|
|
|
on:
|
|
push:
|
|
branches: ['main']
|
|
tags: ['*']
|
|
pull_request:
|
|
branches: ['main']
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUSTFLAGS: '-Dwarnings'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js environment
|
|
uses: actions/setup-node@v4.4.0
|
|
with:
|
|
node-version: '22.x'
|
|
check-latest: true
|
|
|
|
- name: Cache Rust dependencies
|
|
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') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Setup rust
|
|
run: |
|
|
which wasm-pack || cargo install wasm-pack
|
|
which cargo-machete || cargo install cargo-machete
|
|
|
|
- name: Build wasm
|
|
run: |
|
|
wasm-pack build --target web --features wasm
|
|
|
|
- name: Lint
|
|
run: |
|
|
cargo clippy --all-targets --all-features
|
|
cargo fmt --all -- --check
|
|
cargo machete
|
|
|
|
- name: Test
|
|
run: scripts/test.sh
|
|
|
|
publish-crate:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Cache Rust dependencies
|
|
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') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Publish to crates.io
|
|
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
|
|
|
|
publish-npm:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js environment
|
|
uses: actions/setup-node@v4.4.0
|
|
with:
|
|
node-version: '22.x'
|
|
check-latest: true
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Cache Rust dependencies
|
|
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') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Cache npm dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
reconcile-js/node_modules
|
|
~/.npm
|
|
key: ${{ runner.os }}-npm-${{ hashFiles('reconcile-js/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-npm-
|
|
|
|
- name: Setup rust
|
|
run: |
|
|
which wasm-pack || cargo install wasm-pack
|
|
|
|
- name: Build wasm
|
|
run: |
|
|
wasm-pack build --target web --features wasm
|
|
|
|
- name: Build reconcile-js
|
|
run: |
|
|
cd reconcile-js
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Publish reconcile-js to NPM
|
|
run: |
|
|
cd reconcile-js
|
|
cp ../README.md .
|
|
npm publish
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|