Skip to content

Commit 4bd9228

Browse files
authored
sync-azure if release success (#7)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added automatic release synchronization to cloud storage when version tags are published. * Refactored CI workflows to use a reusable, modular sync component for improved maintainability. * Decoupled cloud storage operations into an independent workflow and added validation to ensure required secrets are present. * Support retained for manual dispatch with explicit release selection and clear messaging when falling back to the latest release. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 2a37a10 commit 4bd9228

2 files changed

Lines changed: 28 additions & 12 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,15 @@ jobs:
281281
run: |
282282
echo "::error::One or more builds failed. Please check the logs."
283283
exit 1
284+
285+
################################################################################
286+
# Sync to Azure Storage Job
287+
################################################################################
288+
sync-azure:
289+
name: Sync to Azure Storage
290+
needs: build-summary
291+
if: startsWith(github.ref, 'refs/tags/v')
292+
uses: ./.github/workflows/sync-azure-storage.yml
293+
with:
294+
release_tag: ${{ github.ref_name }}
295+
secrets: inherit

‎.github/workflows/sync-azure-storage.yml‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
name: Sync Release to Azure Storage
22

3-
# This workflow runs after the build.yml workflow completes.
4-
# When a version tag (e.g., v1.0.0) is pushed:
5-
# 1. build.yml is triggered and builds all platforms
6-
# 2. build.yml uploads artifacts to the GitHub Release
7-
# 3. The release is marked as "published"
8-
# 4. This workflow triggers and syncs files to Azure Storage
3+
# This workflow is called by build.yml after a release is created.
94
on:
10-
release:
11-
types: [published]
5+
workflow_call:
6+
inputs:
7+
release_tag:
8+
description: 'Release tag to sync'
9+
required: true
10+
type: string
1211
workflow_dispatch:
12+
inputs:
13+
release_tag:
14+
description: 'Release tag to sync (empty for latest release)'
15+
required: false
16+
type: string
1317

1418
permissions:
1519
contents: read
@@ -34,12 +38,12 @@ jobs:
3438
- name: Determine release tag
3539
id: release_info
3640
run: |
37-
# Get the release tag from the event
38-
if [ "${{ github.event_name }}" = "release" ]; then
39-
RELEASE_TAG="${{ github.event.release.tag_name }}"
41+
# From workflow_call input, or fetch latest for manual dispatch
42+
if [ -n "${{ inputs.release_tag }}" ]; then
43+
RELEASE_TAG="${{ inputs.release_tag }}"
4044
else
41-
# For manual trigger, get the latest release
4245
RELEASE_TAG=$(gh release view --json tagName -q .tagName)
46+
echo "No tag specified, using latest release: ${RELEASE_TAG}"
4347
fi
4448
echo "tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT
4549
echo "Release tag: ${RELEASE_TAG}"

0 commit comments

Comments
 (0)