Repository navigation
Merge pull request #164 from NDDev-OpenNetwork/release/0.0.87 #26
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: publish-crates | |
| on: | |
| push: | |
| tags: | |
| - '[0-9]+.[0-9]+.[0-9]+' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: existing release tag to backfill | |
| required: true | |
| type: string | |
| concurrency: | |
| group: publish-crates-${{ inputs.tag || github.ref_name }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| name: package, verify and publish | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: read | |
| id-token: write # crates.io exchanges this OIDC identity for one short-lived publish token | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ inputs.tag || github.sha }} | |
| persist-credentials: false | |
| - name: Build the self-contained crate | |
| env: | |
| TAG: ${{ inputs.tag || github.ref_name }} | |
| CRATES_OUT: ${{ runner.temp }}/crates-io | |
| run: | | |
| set -euo pipefail | |
| version="${TAG#v}" | |
| test "$version" = "$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" | |
| python3 tools/build_crates_io.py --out "$CRATES_OUT" --harness opencode --version "$version" | |
| cargo package --manifest-path "$CRATES_OUT/opencode-setup-system/Cargo.toml" | |
| cargo install --path "$CRATES_OUT/opencode-setup-system" --root "$CRATES_OUT/install" --locked | |
| "$CRATES_OUT/install/bin/opencode-setup-system" provider-info > "$CRATES_OUT/provider-info.json" | |
| test "$(jq -r .provider_id "$CRATES_OUT/provider-info.json")" = "opencode-setup-system" | |
| - name: Mint a short-lived crates.io token | |
| id: crates | |
| uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5 | |
| - name: Publish opencode-setup-system | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ steps.crates.outputs.token }} | |
| CRATES_OUT: ${{ runner.temp }}/crates-io | |
| run: cargo publish --manifest-path "$CRATES_OUT/opencode-setup-system/Cargo.toml" |