Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ 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-${{ github.ref }}
group: publish-crates-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false

permissions:
Expand All @@ -23,20 +29,22 @@ jobs:
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ inputs.tag || github.sha }}
persist-credentials: false

- name: Build the self-contained crate
env:
TAG: ${{ github.ref_name }}
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-io --harness opencode --version "$version"
cargo package --manifest-path crates-io/opencode-setup-system/Cargo.toml
cargo install --path crates-io/opencode-setup-system --root crates-io/install --locked
crates-io/install/bin/opencode-setup-system provider-info > crates-io/provider-info.json
test "$(jq -r .provider_id crates-io/provider-info.json)" = "opencode-setup-system"
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
Expand All @@ -45,4 +53,5 @@ jobs:
- name: Publish opencode-setup-system
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates.outputs.token }}
run: cargo publish --manifest-path crates-io/opencode-setup-system/Cargo.toml
CRATES_OUT: ${{ runner.temp }}/crates-io
run: cargo publish --manifest-path "$CRATES_OUT/opencode-setup-system/Cargo.toml"
Loading