separate release draft build from publish

This commit is contained in:
Danglewood
2025-10-17 16:19:18 -07:00
parent 99fade2399
commit 109ffe49f7
2 changed files with 64 additions and 207 deletions

View File

@@ -1,54 +1,76 @@
name: 📝 Draft release changelog
name: Build Desktop Draft Release
on:
workflow_dispatch:
inputs:
release_pr_number:
description: "Previous Release PR Number"
required: true
default: ""
tag:
description: "Tag for release (manual input)"
required: true
default: ""
draft:
description: "Create as draft release"
required: false
default: true
type: boolean
jobs:
update_release_draft:
build-windows:
uses: ./.github/workflows/build-desktop-win64.yml
with:
release: true
secrets: inherit
permissions:
contents: write
build-macos-arm:
uses: ./.github/workflows/build-desktop-osxARM.yml
with:
release: true
secrets: inherit
permissions:
contents: write
build-macos-x64:
uses: ./.github/workflows/build-desktop-osx64.yml
with:
release: true
secrets: inherit
permissions:
contents: write
publish:
needs: [build-windows, build-macos-arm, build-macos-x64]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- name: 📟 Checkout code
uses: actions/checkout@v4
- name: 📝 Release Drafter
id: release-drafter
uses: release-drafter/release-drafter@v6.0.0
# with:
# config-name: platform-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 💾 Save Changelog
run: |
cat << 'EOF' > CHANGELOG.md
${{ steps.release-drafter.outputs.body }}
EOF
- name: 🧬 Process Changelog
run: |
pip install requests openai
python .github/scripts/process_changelog.py CHANGELOG.md ${{ github.event.inputs.release_pr_number }}
python .github/scripts/summarize_changelog.py ${{ secrets.GITHUB_TOKEN }} ${{ secrets.OPENAI_API_KEY }}
cat CHANGELOG.md
- name: 🛫 Create Release
uses: mikepenz/action-gh-release@v1
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
body_path: "CHANGELOG.md"
tag_name: ${{ github.event.inputs.tag }}
prerelease: false
path: artifacts
- name: Sanitize artifact filenames
run: |
find ./artifacts -depth -name "* *" | while read -r file; do mv "$file" "$(echo "$file" | tr ' ' '-')"; done
- name: Extract Version and Tag
id: extract_version
run: |
INSTALLER_FILE=$(find ./artifacts -name "*.exe" -o -name "*.dmg" | head -n 1)
VERSION=$(basename "$INSTALLER_FILE" | sed -n 's/.*_\([0-9]\+\.[0-9]\+\.[0-9]\+\)_.*/\1/p')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "release_name=ODP Desktop v$VERSION" >> $GITHUB_OUTPUT
echo "versioned_tag=Open-Data-Platform-v$VERSION" >> $GITHUB_OUTPUT
- name: Prepare assets
id: prep_assets
run: |
mkdir ./release_assets
find ./artifacts -type f -print -exec cp {} ./release_assets/ \;
echo "assets_path=./release_assets" >> $GITHUB_OUTPUT
- name: Create VERSIONED release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.extract_version.outputs.versioned_tag }}
name: ${{ steps.extract_version.outputs.release_name }}
files: ${{ steps.prep_assets.outputs.assets_path }}/*
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,174 +1,11 @@
name: Release ODP Desktop
on:
workflow_call:
inputs:
draft:
required: true
type: boolean
release:
types: [published]
workflow_dispatch:
inputs:
draft:
description: "Create as draft release"
required: false
default: false
type: boolean
jobs:
build-windows:
if: github.event_name != 'release'
uses: ./.github/workflows/build-desktop-win64.yml
with:
release: true
secrets: inherit
permissions:
contents: write
build-macos-arm:
if: github.event_name != 'release'
uses: ./.github/workflows/build-desktop-osxARM.yml
with:
release: true
secrets: inherit
permissions:
contents: write
build-macos-x64:
if: github.event_name != 'release'
uses: ./.github/workflows/build-desktop-osx64.yml
with:
release: true
secrets: inherit
permissions:
contents: write
publish:
needs: [build-windows, build-macos-arm, build-macos-x64]
if: github.event_name != 'release'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.extract_version.outputs.version }}
versioned_tag: ${{ steps.extract_version.outputs.versioned_tag }}
release_name: ${{ steps.extract_version.outputs.release_name }}
is_draft: ${{ github.event.inputs.draft == 'true' || github.event.inputs.draft == true || inputs.draft == true }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Sanitize artifact filenames
run: |
find ./artifacts -depth -name "* *" | while read -r file; do mv "$file" "$(echo "$file" | tr ' ' '-')"; done
- name: Extract Version and Tag
id: extract_version
run: |
INSTALLER_FILE=$(find ./artifacts -name "*.exe" -o -name "*.dmg" | head -n 1)
if [ -z "$INSTALLER_FILE" ]; then
echo "::error::No installer file found in artifacts."
exit 1
fi
VERSION=$(basename "$INSTALLER_FILE" | sed -n 's/.*_\([0-9]\+\.[0-9]\+\.[0-9]\+\)_.*/\1/p')
if [ -z "$VERSION" ]; then
echo "::error::Could not extract version from filename: $(basename "$INSTALLER_FILE")"
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "release_name=ODP Desktop v$VERSION" >> $GITHUB_OUTPUT
echo "versioned_tag=Open-Data-Platform-v$VERSION" >> $GITHUB_OUTPUT
- name: Prepare assets and generate release.json for VERSIONED release
id: prep_assets
run: |
mkdir ./release_assets
find ./artifacts -type f -print -exec cp {} ./release_assets/ \;
cd ./release_assets
VERSION="${{ steps.extract_version.outputs.version }}"
RELEASE_NAME="${{ steps.extract_version.outputs.release_name }}"
VERSIONED_TAG="${{ steps.extract_version.outputs.versioned_tag }}"
cat << EOF > release.json
{
"version": "$VERSION",
"notes": "Release for $RELEASE_NAME",
"pub_date": "$(date -u +'%Y-%m-%dT%H:%M:%SZ')",
"platforms": {
EOF
FIRST_PLATFORM=true
WIN_EXE=$(find . -name "*_x86_64.exe" | head -n 1)
if [ -n "$WIN_EXE" ]; then
WIN_SIG_FILE="${WIN_EXE}.sig"
WIN_SIG=$(cat "$WIN_SIG_FILE")
WIN_URL="https://github.com/${{ github.repository }}/releases/download/${VERSIONED_TAG}/$(basename "$WIN_EXE")"
cat << EOF >> release.json
"windows-x86_64": {
"signature": "$WIN_SIG",
"url": "$WIN_URL"
}
EOF
FIRST_PLATFORM=false
fi
MAC_ARM_TAR=$(find . -name "*_aarch64.app.tar.gz" | head -n 1)
if [ -n "$MAC_ARM_TAR" ]; then
if [ "$FIRST_PLATFORM" = false ]; then
echo "," >> release.json
fi
MAC_ARM_SIG=$(cat "${MAC_ARM_TAR}.sig")
MAC_ARM_URL="https://github.com/${{ github.repository }}/releases/download/${VERSIONED_TAG}/$(basename "$MAC_ARM_TAR")"
cat << EOF >> release.json
"darwin-aarch64": {
"signature": "$MAC_ARM_SIG",
"url": "$MAC_ARM_URL"
}
EOF
FIRST_PLATFORM=false
fi
MAC_X64_TAR=$(find . -name "*_x86_64.app.tar.gz" | head -n 1)
if [ -n "$MAC_X64_TAR" ]; then
if [ "$FIRST_PLATFORM" = false ]; then
echo "," >> release.json
fi
MAC_X64_SIG=$(cat "${MAC_X64_TAR}.sig")
MAC_X64_URL="https://github.com/${{ github.repository }}/releases/download/${VERSIONED_TAG}/$(basename "$MAC_X64_TAR")"
cat << EOF >> release.json
"darwin-x86_64": {
"signature": "$MAC_X64_SIG",
"url": "$MAC_X64_URL"
}
EOF
fi
cat << EOF >> release.json
}
}
EOF
echo "Generated release.json for VERSIONED release:"
cat release.json
cd ..
echo "assets_path=./release_assets" >> $GITHUB_OUTPUT
- name: Create VERSIONED release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.extract_version.outputs.versioned_tag }}
name: ${{ steps.extract_version.outputs.release_name }}
files: ${{ steps.prep_assets.outputs.assets_path }}/*
draft: true
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
update-odp-release:
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
contents: write
@@ -212,7 +49,6 @@ jobs:
run: |
mkdir ./odp_assets
# Copy and rename installer files - replace version with "latest"
for file in $(find ./artifacts -name "*.exe"); do
BASENAME=$(basename "$file")
NEW_NAME=$(echo "$BASENAME" | sed -E 's/_[0-9]+\.[0-9]+\.[0-9]+_/_latest_/')
@@ -241,7 +77,6 @@ jobs:
FIRST_PLATFORM=true
# JSON points to ORIGINAL files in VERSIONED release
WIN_EXE=$(find ../artifacts -name "*_x86_64.exe" | head -n 1)
if [ -n "$WIN_EXE" ]; then
WIN_SIG_FILE="${WIN_EXE}.sig"