Files
Xenia-Canary/.github/workflows/Create_release.yml
Margen67 dd858e234c [CI] Cleanup
Use new archive input to rework artifacts.
Add runs-on and llvm_version inputs and ubuntu_base output to Lint so it can be passed to the Linux job.
Remove broken config input.
Upgrade Windows to VS2026.
2026-06-23 23:23:45 -07:00

115 lines
3.3 KiB
YAML

name: Create Release
on:
workflow_call:
inputs:
tag:
description: 'Full commit SHA for tagging'
required: true
type: string
branch:
description: 'Branch name used as release tag suffix (e.g. canary_experimental)'
default: 'canary_experimental'
type: string
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository for git log access
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Build release notes
id: notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
run: |-
FULL_SHA="${{ inputs.tag }}"
SHORT_SHA="${FULL_SHA::7}"
BRANCH="${{ inputs.branch }}"
TAG_NAME="$SHORT_SHA"
TITLE="${SHORT_SHA}_$BRANCH"
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
echo "title=$TITLE" >> $GITHUB_OUTPUT
PREV_TAG=$(gh release list \
--repo "$REPO" \
--limit 1 \
--json tagName \
--jq '.[0].tagName' 2>/dev/null || echo)
if [ -n "$PREV_TAG" ]; then
PREV_SHA=$(git rev-parse "${PREV_TAG}^{}" 2>/dev/null || \
git rev-parse "${PREV_TAG}" 2>/dev/null || echo)
fi
if [ -n "$PREV_SHA" ]; then
COMMITS=$(git log --format='- %s (`%h`)' --abbrev=7 "${PREV_SHA}..$FULL_SHA" --)
COMPARE_URL="https://github.com/${REPO}/compare/${PREV_TAG}...$TAG_NAME"
else
COMMITS=$(git log --format='- %s (`%h`)' --abbrev=7 -1 "$FULL_SHA" --)
fi
# Assemble body
{
echo "body<<RELEASE_BODY_EOF"
if [ -n "$COMMITS" ]; then
echo "### Changes"
echo
echo "$COMMITS"
fi
if [ -n "$COMPARE_URL" ]; then
echo
echo "**Full changelog**: $COMPARE_URL"
fi
echo "RELEASE_BODY_EOF"
} >> $GITHUB_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: release_assets
merge-multiple: true
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
TAG: ${{ steps.notes.outputs.tag_name }}
TITLE: ${{ steps.notes.outputs.title }}
BODY: ${{ steps.notes.outputs.body }}
TARGET: ${{ inputs.tag }}
run: |-
echo "$BODY" > release_notes.md
echo "Creating release: $TAG"
# Check if tag/release already exists (re-run safety)
if gh release view "$TAG" --repo "$REPO" --json tagName 2>/dev/null; then
echo "Release $TAG exists, uploading new assets..."
gh release upload "$TAG" \
--repo "$REPO" \
--clobber \
release_assets/*
else
gh release create "$TAG" \
--repo "$REPO" \
--target "${{ inputs.tag }}" \
--title "$TITLE" \
--notes-file release_notes.md \
--latest \
release_assets/*
fi
echo "✅ Release $TAG published"