626d013547
* switch from yarn to pnpm * Remove full-nym-wasm (#6796) * Remove nym-browser-extension (#6798) * Remove nym-browser-extension * remove unused from makefile * Remove Node tester (#6800) * Remove dom-utils (#6801) * gh-actions: remove pnpm version * nuke dist and pkg * add missing dependency * set node version to 24 and pnpm version to 11 * upgrade lock file from pnpm version 9 to 11 * pnpm add approved builds * yarn -> pnpm * upgrade jest version * yarn -> pnpm * Remove unused cfg; clippy! * pnpm: when dev mode is on, unfreeze the lock file * pnpm approve more scripts * pnpm syntax error * add `pnpm i` * disable eslint temporarily while switching to biome in later PR --------- Co-authored-by: Mark Sinclair <mmsinclair@users.noreply.github.com> Co-authored-by: mfahampshire <maxhampshire@pm.me>
124 lines
4.0 KiB
YAML
124 lines
4.0 KiB
YAML
name: Publish to crates.io (dry run)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to publish (e.g. 1.21.0)"
|
|
required: true
|
|
type: string
|
|
|
|
env:
|
|
CI_BOT_AUTHOR: "Nym bot"
|
|
CI_BOT_EMAIL: "nym-bot@users.noreply.github.com"
|
|
|
|
jobs:
|
|
publish-dry-run:
|
|
runs-on: arc-linux-latest
|
|
timeout-minutes: 35
|
|
env:
|
|
RUSTUP_PERMIT_COPY_RENAME: 1
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Configure git identity
|
|
run: |
|
|
git config --global user.name "${{ env.CI_BOT_AUTHOR }}"
|
|
git config --global user.email "${{ env.CI_BOT_EMAIL }}"
|
|
|
|
- name: Install rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Install cargo-workspaces
|
|
run: cargo install cargo-workspaces
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
|
|
- name: Validate version format
|
|
run: |
|
|
if ! npx semver "${{ inputs.version }}"; then
|
|
echo "Error: '${{ inputs.version }}' is not valid semver"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Get current version
|
|
id: current_version
|
|
run: |
|
|
VERSION=$(grep -oP '^\s*version\s*=\s*"\K[0-9]+\.[0-9]+\.[0-9]+' Cargo.toml | head -1)
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Update workspace dependencies
|
|
run: |
|
|
# Match any semver version on lines with `path = `, not just the current workspace version.
|
|
sed -i '/path = /s/version = "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"/version = "${{ inputs.version }}"/g' Cargo.toml
|
|
|
|
- name: Bump versions (local only)
|
|
run: |
|
|
cargo workspaces version custom ${{ inputs.version }} \
|
|
--no-git-commit \
|
|
--yes
|
|
|
|
- name: Preflight publish checks
|
|
run: |
|
|
python3 tools/internal/check_publish_preflight.py
|
|
|
|
# Dry run may show cascading dependency errors because packages aren't
|
|
# actually uploaded - these are expected and ignored. We check for real
|
|
# errors like packaging failures, missing metadata, or invalid Cargo.toml.
|
|
- name: Publish (dry run)
|
|
run: |
|
|
set +e
|
|
publish_status=1
|
|
max_attempts=2
|
|
attempt=1
|
|
rm -f /tmp/publish-dry-run.log
|
|
|
|
while [ "$attempt" -le "$max_attempts" ]; do
|
|
echo "Dry-run publish attempt ${attempt}/${max_attempts}"
|
|
cargo workspaces publish --dry-run --allow-dirty 2>&1 | tee /tmp/publish-dry-run.log
|
|
publish_status=${PIPESTATUS[0]}
|
|
|
|
if [ "$publish_status" -eq 0 ]; then
|
|
break
|
|
fi
|
|
|
|
# Retry once for interruption/runner issues.
|
|
if [ "$attempt" -lt "$max_attempts" ] && \
|
|
{ [ "$publish_status" -eq 130 ] || [ "$publish_status" -eq 137 ]; }; then
|
|
echo "Publish dry-run interrupted (exit ${publish_status}), retrying in 10s..."
|
|
sleep 10
|
|
attempt=$((attempt + 1))
|
|
continue
|
|
fi
|
|
|
|
break
|
|
done
|
|
set -e
|
|
|
|
if grep -Eiq \
|
|
"failed to verify manifest|failed to parse manifest|invalid Cargo.toml|error: package .* has no (description|license|repository)" \
|
|
/tmp/publish-dry-run.log; then
|
|
echo "Detected real packaging/manifest errors"
|
|
exit 1
|
|
fi
|
|
|
|
# In dry-run mode, non-zero publish status is expected due to
|
|
# dependency-cascade failures against crates.io index.
|
|
if [ "$publish_status" -ne 0 ]; then
|
|
echo "Dry-run publish returned non-zero (${publish_status}) but no real manifest blockers were detected."
|
|
fi
|
|
|
|
echo "Only expected dry-run dependency cascade errors detected (if any)."
|
|
|
|
# Show the list of packages published
|
|
- name: Show package versions
|
|
run: cargo workspaces list --long
|