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
26 changes: 20 additions & 6 deletions .github/workflows/expert-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
definition:
- name: create-expert
path: definitions/create-expert
draft-id: ${{ vars.EXPERT_DRAFT_ID_CREATE_EXPERT }}
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -45,28 +44,43 @@ jobs:
echo "should-publish=true" >> "$GITHUB_OUTPUT"
fi

- name: Publish scope if private
- name: Resolve draft ID
if: steps.check.outputs.should-publish == 'true'
id: draft
run: |
bun ./apps/perstack/bin/cli.ts expert publish ${{ matrix.definition.name }} \
--api-key ${{ secrets.PERSTACK_PRODUCTION_API_KEY }} || true
OUTPUT=$(bun ./apps/perstack/bin/cli.ts expert list --filter ${{ matrix.definition.name }} \
--api-key ${{ secrets.PERSTACK_PRODUCTION_API_KEY }})
echo "$OUTPUT"
DRAFT_ID=$(echo "$OUTPUT" | grep "ID:" | head -1 | awk '{print $2}')
if [ -z "$DRAFT_ID" ]; then
echo "::error::Draft scope not found for ${{ matrix.definition.name }}"
exit 1
fi
echo "draft-id=$DRAFT_ID" >> "$GITHUB_OUTPUT"
echo "Resolved draft ID: $DRAFT_ID"

- name: Push to draft
if: steps.check.outputs.should-publish == 'true'
id: push
run: |
OUTPUT=$(bun ./apps/perstack/bin/cli.ts expert push ${{ matrix.definition.draft-id }} \
OUTPUT=$(bun ./apps/perstack/bin/cli.ts expert push ${{ steps.draft.outputs.draft-id }} \
--config ${{ matrix.definition.path }}/perstack.toml \
--api-key ${{ secrets.PERSTACK_PRODUCTION_API_KEY }})
echo "$OUTPUT"
REF_ID=$(echo "$OUTPUT" | grep "Ref ID:" | awk '{print $3}')
echo "ref-id=$REF_ID" >> "$GITHUB_OUTPUT"

- name: Publish scope if private
if: steps.check.outputs.should-publish == 'true'
run: |
bun ./apps/perstack/bin/cli.ts expert publish ${{ matrix.definition.name }} \
--api-key ${{ secrets.PERSTACK_PRODUCTION_API_KEY }} || true

- name: Assign version
if: steps.check.outputs.should-publish == 'true'
run: |
bun ./apps/perstack/bin/cli.ts expert version \
${{ matrix.definition.draft-id }} \
${{ steps.draft.outputs.draft-id }} \
${{ steps.push.outputs.ref-id }} \
${{ steps.version.outputs.version }} \
--tag latest \
Expand Down