- release.yml, generated by dist from dist-workspace.toml, builds macOS, Linux and Windows, attests every artifact, and publishes shell and PowerShell installers with their updater, a luxe formula in evanwhittaker/homebrew-tap, and the crates through Trusted Publishing (publish-crates.yml, which skips versions crates.io already has). - luxe update recognizes an installer copy by luxe-cli-update beside it and runs that. - The README, the install guide and the site lead with the installer, Homebrew and Windows. - SECURITY.md: report privately through a GitHub advisory or contact@luxe.dev.
69 lines
2.7 KiB
YAML
69 lines
2.7 KiB
YAML
# Publish crates — the release's crates go to crates.io.
|
|
#
|
|
# A dist custom publish job (`publish-jobs` in dist-workspace.toml): release.yml calls it once the
|
|
# GitHub release hosts the artifacts, and announces only after it succeeds.
|
|
#
|
|
# No token is stored. crates.io Trusted Publishing trusts the OIDC token GitHub mints for the run,
|
|
# and it matches the *calling* workflow, so each crate's trusted publisher names `release.yml`,
|
|
# not this file.
|
|
#
|
|
# A crate whose version crates.io already has is skipped, so a re-run after a partial publish, or
|
|
# a release whose crates were published by hand first, carries on rather than failing announce.
|
|
name: Publish crates
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
plan:
|
|
required: true
|
|
type: string
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
publish:
|
|
name: publish to crates.io
|
|
# A tag pushed to the development repository must never publish; skipped, announce still runs
|
|
if: github.repository == 'evanwhittaker/luxe'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable
|
|
|
|
- name: Which crates crates.io still needs
|
|
id: pending
|
|
shell: bash
|
|
run: |
|
|
exclude=""
|
|
pending=0
|
|
while read -r name version; do
|
|
status=$(curl -s -o /dev/null -w '%{http_code}' -A 'luxe release (github.com/evanwhittaker/luxe)' \
|
|
"https://crates.io/api/v1/crates/$name/$version")
|
|
case "$status" in
|
|
200) echo "$name $version is already published"; exclude="$exclude --exclude $name" ;;
|
|
404) echo "$name $version will be published"; pending=$((pending + 1)) ;;
|
|
*) echo "crates.io answered $status for $name $version" >&2; exit 1 ;;
|
|
esac
|
|
done < <(cargo metadata --no-deps --format-version 1 \
|
|
| jq -r '.packages[] | select(.publish == null or (.publish | length > 0)) | "\(.name) \(.version)"')
|
|
echo "exclude=$exclude" >> "$GITHUB_OUTPUT"
|
|
echo "count=$pending" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Trusted Publishing token
|
|
if: steps.pending.outputs.count != '0'
|
|
id: auth
|
|
uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
|
|
|
|
# Dependencies first, which `--workspace` orders for us
|
|
- name: Publish
|
|
if: steps.pending.outputs.count != '0'
|
|
run: cargo publish --workspace --locked $EXCLUDE
|
|
env:
|
|
EXCLUDE: ${{ steps.pending.outputs.exclude }}
|
|
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
|