Files
frid/.github/workflows/publish.yml
T
2026-11-20 14:01:56 +00:00

73 lines
2.1 KiB
YAML

name: Publish crates
on:
push:
tags:
- "v[0-9]*"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: crates-io-publish
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 10
jobs:
build:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.97"
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: python3 -m unittest discover -s scripts -p 'test_*.py'
- run: cargo fmt --all -- --check
- run: cargo check --workspace --all-targets --all-features --locked
- run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
- run: cargo test --workspace --locked
- name: Verify release packages once
run: python3 scripts/publish_crates.py --dry-run
publish-crates-io:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.97"
- name: Publish to crates.io without rebuilding
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: python3 scripts/publish_crates.py --no-verify
publish-gitea:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.97"
- name: Publish mirror to Gitea without rebuilding
env:
GITEA_PACKAGES_TOKEN: ${{ secrets.GITEA_PACKAGES_TOKEN }}
run: |
if [ -z "$GITEA_PACKAGES_TOKEN" ]; then
echo "::error::Add the GITEA_PACKAGES_TOKEN repository Actions secret, then rerun this workflow."
exit 1
fi
export CARGO_REGISTRIES_GITEA_TOKEN="Bearer $GITEA_PACKAGES_TOKEN"
python3 scripts/publish_crates.py --registry gitea --no-verify