Files
framework/.github/workflows/publish.yml
T
Alex 762c6b7a41
Tests / test (push) Has been cancelled
ci: publish macros first, then framework
2026-05-31 02:58:16 +03:00

71 lines
2.0 KiB
YAML

name: Publish to crates.io
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (preview without publishing)'
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'
env:
CARGO_TERM_COLOR: always
jobs:
publish-macros:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Login to crates.io
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: Get macros version
id: get_version
run: echo "version=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name=="desert-framework-macros") | .version')" >> $GITHUB_OUTPUT
- name: Publish desert-framework-macros
run: |
if [ "${{ inputs.dry_run }}" = "true" ]; then
cargo publish -p desert-framework-macros --dry-run --allow-dirty
else
cargo publish -p desert-framework-macros --allow-dirty
fi
publish-framework:
runs-on: ubuntu-latest
needs: publish-macros
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Login to crates.io
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: Wait for crates.io index
run: sleep 30
- name: Replace path dependency with version
run: |
MACROS_VERSION=${{ needs.publish-macros.outputs.version }}
sed -i "s|desert-framework-macros = { path = \"../desert-framework-macros\" }|desert-framework-macros = \"${MACROS_VERSION}\"|" desert-framework/Cargo.toml
- name: Publish desert_framework
run: |
if [ "${{ inputs.dry_run }}" = "true" ]; then
cargo publish -p desert_framework --dry-run --allow-dirty
else
cargo publish -p desert_framework --allow-dirty
fi