You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.0 KiB
104 lines
3.0 KiB
name: Draft image release
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: read
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
official_images_pr:
|
|
description: Optional official-images PR number to use instead of auto-detect
|
|
required: false
|
|
type: string
|
|
release_tag:
|
|
description: Optional explicit release tag, for example v2026.06.1
|
|
required: false
|
|
type: string
|
|
#schedule:
|
|
# - cron: "23 * * * *"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.repository }}
|
|
cancel-in-progress: false
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash -Eeuo pipefail {0}
|
|
|
|
jobs:
|
|
draft-release:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Verify required tools
|
|
run: |
|
|
gh --version
|
|
jq --version
|
|
git --version
|
|
|
|
- name: Generate release draft payload
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
REPO: ${{ github.repository }}
|
|
INPUT_OFFICIAL_IMAGES_PR: ${{ inputs.official_images_pr }}
|
|
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
|
|
run: .github/scripts/generate-release-draft.sh
|
|
|
|
- name: Create or update draft release
|
|
if: env.SKIP_RELEASE != 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
REPO: ${{ github.repository }}
|
|
run: |
|
|
if gh release view "$RELEASE_TAG" --repo "$REPO" >/dev/null 2>&1; then
|
|
echo "Updating existing draft release $RELEASE_TAG"
|
|
gh release edit "$RELEASE_TAG" \
|
|
--repo "$REPO" \
|
|
--draft=true \
|
|
--title "$RELEASE_TAG" \
|
|
--notes-file "$RUNNER_TEMP/release-notes.md"
|
|
else
|
|
echo "Creating draft release $RELEASE_TAG targeting $TARGET_SHA"
|
|
gh release create "$RELEASE_TAG" \
|
|
--repo "$REPO" \
|
|
--draft \
|
|
--title "$RELEASE_TAG" \
|
|
--target "$TARGET_SHA" \
|
|
--notes-file "$RUNNER_TEMP/release-notes.md"
|
|
fi
|
|
|
|
- name: Workflow summary
|
|
if: env.SKIP_RELEASE != 'true'
|
|
env:
|
|
REPO: ${{ github.repository }}
|
|
run: |
|
|
release_url="https://github.com/${REPO}/releases/tag/${RELEASE_TAG}"
|
|
{
|
|
echo "## Draft release prepared"
|
|
echo
|
|
echo "- Release tag: \`$RELEASE_TAG\`"
|
|
echo "- Target SHA: \`$TARGET_SHA\`"
|
|
echo "- Previous tag: \`$PREVIOUS_TAG\`"
|
|
echo "- Official Images PR: [#${OFFICIAL_IMAGES_PR}](${OFFICIAL_IMAGES_PR_URL})"
|
|
echo "- Draft release: [${RELEASE_TAG}](${release_url})"
|
|
echo
|
|
echo "### Generated notes"
|
|
echo
|
|
cat "$RUNNER_TEMP/release-notes.md"
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Skip summary
|
|
if: env.SKIP_RELEASE == 'true'
|
|
run: |
|
|
{
|
|
echo "## No release drafted"
|
|
echo
|
|
echo "$SKIP_REASON"
|
|
} >> "$GITHUB_STEP_SUMMARY"
|