Skip to content

Commit 4083bf2

Browse files
author
Factory Bot
committed
ci: auto-publish to R2 after CLI release
1 parent 25eeb7f commit 4083bf2

2 files changed

Lines changed: 48 additions & 6 deletions

File tree

.github/workflows/publish-r2.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
required: true
99
type: string
1010
release_run_id:
11-
description: "Release workflow run ID to download artifacts from"
12-
required: true
11+
description: "Release workflow run ID to download artifacts from (leave empty if called from release workflow)"
12+
required: false
1313
type: string
1414
channel:
1515
description: "Release channel"
@@ -24,6 +24,28 @@ on:
2424
description: "Brief release notes (optional)"
2525
required: false
2626
type: string
27+
workflow_call:
28+
inputs:
29+
version:
30+
description: "Version to publish"
31+
required: true
32+
type: string
33+
channel:
34+
description: "Release channel"
35+
required: false
36+
type: string
37+
default: stable
38+
release_notes:
39+
description: "Brief release notes"
40+
required: false
41+
type: string
42+
secrets:
43+
R2_ACCESS_KEY_ID:
44+
required: true
45+
R2_SECRET_ACCESS_KEY:
46+
required: true
47+
CLOUDFLARE_ACCOUNT_ID:
48+
required: true
2749

2850
env:
2951
BINARY_NAME: Cortex
@@ -43,19 +65,23 @@ jobs:
4365
steps:
4466
- uses: actions/checkout@v4
4567

46-
- name: Download artifacts from Release run
68+
- name: Download artifacts from Release run (workflow_dispatch with run_id)
69+
if: github.event_name == 'workflow_dispatch' && inputs.release_run_id != ''
4770
env:
4871
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4972
run: |
5073
mkdir -p artifacts
5174
echo "Downloading artifacts from run ${{ inputs.release_run_id }}..."
52-
53-
# Download all artifacts from the release run
5475
gh run download ${{ inputs.release_run_id }} --dir artifacts
55-
5676
echo "Downloaded artifacts:"
5777
ls -la artifacts/
5878
79+
- name: Download artifacts from current workflow
80+
if: github.event_name == 'workflow_call' || (github.event_name == 'workflow_dispatch' && inputs.release_run_id == '')
81+
uses: actions/download-artifact@v4
82+
with:
83+
path: artifacts
84+
5985
- name: Verify artifacts exist
6086
run: |
6187
EXPECTED_ARTIFACTS=(

.github/workflows/release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,19 @@ jobs:
390390
artifacts/*
391391
env:
392392
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
393+
394+
# ==========================================================================
395+
# Publish CLI to R2
396+
# ==========================================================================
397+
publish-r2:
398+
name: Publish to R2
399+
needs: [prepare, build-cli, release]
400+
if: needs.prepare.outputs.build_cli == 'true' && needs.build-cli.result == 'success'
401+
uses: ./.github/workflows/publish-r2.yml
402+
with:
403+
version: ${{ needs.prepare.outputs.version }}
404+
channel: ${{ contains(needs.prepare.outputs.version, '-') && 'beta' || 'stable' }}
405+
secrets:
406+
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
407+
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
408+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

0 commit comments

Comments
 (0)