Skip to content

0.3.0

0.3.0 #9

Workflow file for this run

name: Publish Rust Crates
on:
release:
types:
- published
permissions:
contents: read
concurrency:
group: publish-rust-${{ github.event.release.tag_name || github.ref_name }}
cancel-in-progress: false
jobs:
resolve-version:
uses: ./.github/workflows/resolve-release-version.yml
with:
release_tag: ${{ github.event.release.tag_name || '' }}
ref_name: ${{ github.ref_name }}
ref_type: ${{ github.ref_type }}
missing_message: "Publish a GitHub Release or run this workflow on a tag ref."
version-check:
needs: resolve-version
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Validate release ref
shell: bash
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
REF_TYPE: ${{ github.ref_type }}
run: |
if [ -z "$RELEASE_TAG" ] && [ "$REF_TYPE" != "tag" ]; then
echo "::error::Rust crates may only be published from a version tag."
exit 1
fi
- name: Validate lockstep versions against tag
run: python3 scripts/manage_versions.py check --tag "${{ needs.resolve-version.outputs.version }}"
package-check:
needs: [resolve-version, version-check]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Verify Rust crates package cleanly
run: cargo package --manifest-path rust/Cargo.toml -p tstring-syntax -p tstring-json -p tstring-toml -p tstring-yaml
publish-syntax:
needs: [resolve-version, package-check]
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: crates-io
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Publish tstring-syntax
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --manifest-path rust/Cargo.toml -p tstring-syntax
publish-json:
needs: [resolve-version, publish-syntax]
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: crates-io
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Wait for tstring-syntax to appear on crates.io
run: python3 .github/scripts/wait_for_crate.py tstring-syntax
- name: Publish tstring-json
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --manifest-path rust/Cargo.toml -p tstring-json
publish-toml:
needs: [resolve-version, publish-json]
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: crates-io
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Publish tstring-toml
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --manifest-path rust/Cargo.toml -p tstring-toml
publish-yaml:
needs: [resolve-version, publish-toml]
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: crates-io
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: refs/tags/${{ needs.resolve-version.outputs.tag_name }}
persist-credentials: false
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.94.0
- name: Publish tstring-yaml
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --manifest-path rust/Cargo.toml -p tstring-yaml