Skip to content

Update publish.yml #1491

Update publish.yml

Update publish.yml #1491

Workflow file for this run

name: Publish Package to npm
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions: write-all
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Cache cargo registry + target
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-benchmark-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-benchmark-${{ runner.os }}-
- uses: oven-sh/setup-bun@v2
name: Install bun
- name: Cache bun dependencies
uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: bun-benchmark-${{ runner.os }}-${{ hashFiles('**/bun.lock') }}
restore-keys: |
bun-${{ runner.os }}-
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: 'latest'
- name: Install Node.js
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
node-version: 24
- run: bun install
- run: bun run build
- name: Benchmark
run: bun run benchmark
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Cache cargo registry + target
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-publish-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-benchmark-${{ runner.os }}-
- uses: oven-sh/setup-bun@v2
name: Install bun
- name: Cache bun dependencies
uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: bun-publish-${{ runner.os }}-${{ hashFiles('**/bun.lock') }}
restore-keys: |
bun-${{ runner.os }}-
- uses: jetli/wasm-pack-action@v0.4.0
with:
version: 'latest'
- name: Install Node.js
uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
node-version: 24
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: bun install
- run: bun run build
- run: |
bun run lint
# rust coverage issue
echo 'max_width = 100000' > .rustfmt.toml
echo 'tab_spaces = 4' >> .rustfmt.toml
echo 'newline_style = "Unix"' >> .rustfmt.toml
echo 'fn_call_width = 100000' >> .rustfmt.toml
echo 'fn_params_layout = "Compressed"' >> .rustfmt.toml
echo 'chain_width = 100000' >> .rustfmt.toml
echo 'merge_derives = true' >> .rustfmt.toml
echo 'use_small_heuristics = "Default"' >> .rustfmt.toml
cargo fmt
- name: Install cargo-binstall
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install cargo-tarpaulin
run: cargo binstall cargo-tarpaulin --no-confirm
- run: bun run test
- name: Format Rollback
run: |
rm -rf .rustfmt.toml
cargo fmt
- name: Build Landing
run: |
bun run --filter @devup-ui/components build-storybook
mv ./packages/components/storybook-static ./apps/landing/public/storybook
bun run --filter landing build
- name: Cache Playwright Browsers
id: playwright-cache
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: playwright-publish-${{ runner.os }}-${{ hashFiles('**/bun.lock') }}
restore-keys: |
playwright-${{ runner.os }}-
- name: Install Playwright Browsers
run: bunx playwright install chromium --with-deps
- name: Check for Existing E2E Snapshots
id: check-snapshots
run: |
SNAPSHOT_COUNT=$(find e2e -name '*.png' -path '*-snapshots/*' 2>/dev/null | wc -l)
echo "count=$SNAPSHOT_COUNT" >> $GITHUB_OUTPUT
echo "Found $SNAPSHOT_COUNT existing snapshot(s)"
- name: Generate E2E Snapshots
if: steps.check-snapshots.outputs.count == '0'
run: bunx playwright test --update-snapshots
- name: Commit E2E Snapshots
if: steps.check-snapshots.outputs.count == '0' && github.event_name == 'pull_request'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: generate e2e visual snapshots from CI"
file_pattern: "e2e/**/*-snapshots/*.png"
- name: Run E2E Tests
run: bun run test:e2e
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./apps/landing/out
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
- uses: actions/deploy-pages@v4
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
- name: Build Landing (singleCss)
run: |
rm -rf apps/landing/out apps/landing/.next apps/landing/df
DEVUP_SINGLE_CSS=1 bun run --filter landing build
- name: Run E2E Tests (singleCss)
run: bun run test:e2e
- name: Upload singleCss Playwright Report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-singlecss
path: playwright-report/
retention-days: 30
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage/lcov.info
- uses: changepacks/action@main
id: changepacks
with:
publish: true
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}