ci(release): trigger release workflow from promotion and internal builds (#3315)

pull/3316/head
James Rich 2025-10-03 13:30:40 -05:00 zatwierdzone przez GitHub
rodzic a3d058962c
commit cbeecd5385
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
3 zmienionych plików z 53 dodań i 19 usunięć

Wyświetl plik

@ -13,6 +13,7 @@ on:
permissions:
contents: write
actions: write
jobs:
create-internal-tag:
@ -60,9 +61,33 @@ jobs:
git push origin "$TAG"
echo "Created and pushed $TAG"
- name: Trigger Release Workflow for Tag
if: ${{ inputs.dry_run != 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TAG='${{ steps.tag.outputs.internal_tag }}'
echo "Dispatching release workflow for $TAG"
for i in {1..5}; do
if gh api \
-X POST \
-H "Accept: application/vnd.github+json" \
repos/${{ github.repository }}/actions/workflows/release.yml/dispatches \
-f ref="$TAG"; then
echo "Triggered release workflow for $TAG"
break
fi
echo "Retry $i/5 in 5s..."
sleep 5
done
- name: Output Summary
run: |
echo "### Internal Tag Created" >> $GITHUB_STEP_SUMMARY
echo "Tag: ${{ steps.tag.outputs.internal_tag }}" >> $GITHUB_STEP_SUMMARY
echo "Base Version: ${{ inputs.base_version }}" >> $GITHUB_STEP_SUMMARY
echo "Dry Run: ${{ inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
if [ "${{ inputs.dry_run }}" != "true" ]; then
echo "Release workflow dispatched for tag ${{ steps.tag.outputs.internal_tag }}" >> $GITHUB_STEP_SUMMARY
fi

Wyświetl plik

@ -23,6 +23,7 @@ on:
permissions:
contents: write
actions: write
jobs:
promote:
@ -186,6 +187,27 @@ jobs:
git push origin "$TAG"
echo "Created and pushed $TAG"
- name: Trigger Release Workflow for Tag
if: ${{ inputs.dry_run != 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TAG='${{ steps.tag.outputs.new_tag }}'
echo "Dispatching release workflow for $TAG"
for i in {1..5}; do
if gh api \
-X POST \
-H "Accept: application/vnd.github+json" \
repos/${{ github.repository }}/actions/workflows/release.yml/dispatches \
-f ref="$TAG"; then
echo "Triggered release workflow for $TAG"
break
fi
echo "Retry $i/5 in 5s..."
sleep 5
done
- name: Promotion Summary
run: |
echo "### Promotion Tag Created" >> $GITHUB_STEP_SUMMARY
@ -194,3 +216,6 @@ jobs:
echo "Target Stage: ${{ steps.decide.outputs.target_stage }}" >> $GITHUB_STEP_SUMMARY
echo "New Tag: ${{ steps.tag.outputs.new_tag }}" >> $GITHUB_STEP_SUMMARY
echo "Dry Run: ${{ inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
if [ "${{ inputs.dry_run }}" != "true" ]; then
echo "Release workflow dispatched for tag ${{ steps.tag.outputs.new_tag }}" >> $GITHUB_STEP_SUMMARY
fi

Wyświetl plik

@ -56,7 +56,7 @@ jobs:
- name: Extract VERSION_CODE_OFFSET from config.properties
id: get_version_code_offset
run: |
OFFSET=$(grep '^VERSION_CODE_OFFSET=' config.properties | cut-d'=' -f2)
OFFSET=$(grep '^VERSION_CODE_OFFSET=' config.properties | cut -d'=' -f2)
echo "VERSION_CODE_OFFSET=$OFFSET" >> $GITHUB_OUTPUT
- name: Calculate Version Code from Git Commit Count
@ -276,29 +276,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Determine Release Properties for Promotion
if: "!contains(github.ref_name, '-internal')"
id: release_properties
run: |
TAG_NAME="${{ github.ref_name }}"
if [[ "$TAG_NAME" == *"-closed"* ]]; then
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
elif [[ "$TAG_NAME" == *"-open"* ]]; then
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Promote GitHub Release
if: "!contains(github.ref_name, '-internal')"
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare-build-info.outputs.BASE_TAG }}
name: ${{ github.ref_name }}
draft: ${{ steps.release_properties.outputs.draft }}
prerelease: ${{ steps.release_properties.outputs.prerelease }}
draft: false
prerelease: ${{ contains(github.ref_name, '-closed') || contains(github.ref_name, '-open') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}