mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 21:42:22 +00:00
fix release build
This commit is contained in:
188
.github/workflows/release-desktop.yml
vendored
188
.github/workflows/release-desktop.yml
vendored
@@ -3,9 +3,6 @@ name: Release ODP Desktop
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
required: true
|
||||
type: string
|
||||
draft:
|
||||
required: true
|
||||
type: boolean
|
||||
@@ -13,10 +10,6 @@ on:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Tag for release"
|
||||
required: false
|
||||
default: ""
|
||||
draft:
|
||||
description: "Create as draft release"
|
||||
required: false
|
||||
@@ -54,8 +47,9 @@ jobs:
|
||||
contents: write
|
||||
outputs:
|
||||
version: ${{ steps.extract_version.outputs.version }}
|
||||
tag: ${{ steps.extract_version.outputs.tag }}
|
||||
is_draft: ${{ github.event.inputs.draft == 'true' || github.event.inputs.draft == true}}
|
||||
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
|
||||
@@ -69,44 +63,21 @@ jobs:
|
||||
- name: Extract Version and Tag
|
||||
id: extract_version
|
||||
run: |
|
||||
# Use input tag if provided, otherwise extract from artifacts
|
||||
if [ -n "${{ github.event.inputs.tag }}" ]; then
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
# Try to extract version from tag, otherwise extract from artifacts
|
||||
VERSION=$(echo "$TAG" | sed 's/^[^0-9]*//')
|
||||
if [ -z "$VERSION" ]; then
|
||||
# If tag doesn't contain version, extract from artifact filename
|
||||
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 tag or filename: $(basename "$INSTALLER_FILE")"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "release_name=$TAG" >> $GITHUB_OUTPUT
|
||||
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
||||
else
|
||||
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=Open Data Platform v$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "tag=Open-Data-Platform-v$VERSION" >> $GITHUB_OUTPUT
|
||||
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=Open Data Platform v$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "versioned_tag=Open-Data-Platform-v$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Prepare assets and generate release.json
|
||||
- name: Prepare assets and generate release.json for VERSIONED release
|
||||
id: prep_assets
|
||||
run: |
|
||||
mkdir ./release_assets
|
||||
@@ -114,7 +85,8 @@ jobs:
|
||||
cd ./release_assets
|
||||
VERSION="${{ steps.extract_version.outputs.version }}"
|
||||
RELEASE_NAME="${{ steps.extract_version.outputs.release_name }}"
|
||||
TAG="${{ steps.extract_version.outputs.tag }}"
|
||||
VERSIONED_TAG="${{ steps.extract_version.outputs.versioned_tag }}"
|
||||
|
||||
cat << EOF > release.json
|
||||
{
|
||||
"version": "$VERSION",
|
||||
@@ -122,39 +94,46 @@ jobs:
|
||||
"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/${TAG}/$(basename "$WIN_EXE")"
|
||||
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 [ -n "$WIN_EXE" ]; 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/${TAG}/$(basename "$MAC_ARM_TAR")"
|
||||
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 [ -n "$WIN_EXE" ] || [ -n "$MAC_ARM_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/${TAG}/$(basename "$MAC_X64_TAR")"
|
||||
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",
|
||||
@@ -162,32 +141,28 @@ jobs:
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF >> release.json
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo "Generated release.json:"
|
||||
|
||||
echo "Generated release.json for VERSIONED release:"
|
||||
cat release.json
|
||||
cd ..
|
||||
echo "assets_path=./release_assets" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload release assets
|
||||
- name: Create VERSIONED release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ steps.extract_version.outputs.tag }}
|
||||
tag_name: ${{ steps.extract_version.outputs.versioned_tag }}
|
||||
name: ${{ steps.extract_version.outputs.release_name }}
|
||||
files: ${{ steps.prep_assets.outputs.assets_path }}/*
|
||||
draft: ${{ github.event.inputs.draft == 'true' || github.event.inputs.draft == true }}
|
||||
draft: ${{ github.event.inputs.draft == 'true' || github.event.inputs.draft == true || inputs.draft == true }}
|
||||
prerelease: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload release.json as artifact for odp job
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-json
|
||||
path: ./release_assets/release.json
|
||||
|
||||
update-latest-tag:
|
||||
update-odp-release:
|
||||
needs: publish
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
@@ -209,25 +184,98 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Prepare latest assets
|
||||
- name: Prepare ODP assets and generate latest.json for ODP release
|
||||
run: |
|
||||
mkdir ./odp_assets
|
||||
|
||||
find ./artifacts -name "*.exe" -exec cp {} ./odp_assets/ \;
|
||||
find ./artifacts -name "*.dmg" -exec cp {} ./odp_assets/ \;
|
||||
if [ -f ./artifacts/release-json/release.json ]; then
|
||||
cp ./artifacts/release-json/release.json ./odp_assets/latest.json
|
||||
|
||||
VERSION="${{ needs.publish.outputs.version }}"
|
||||
RELEASE_NAME="${{ needs.publish.outputs.release_name }}"
|
||||
|
||||
cd ./odp_assets
|
||||
|
||||
cat << EOF > latest.json
|
||||
{
|
||||
"version": "$VERSION",
|
||||
"notes": "Latest stable release - $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="../artifacts/windows-release/$(basename "${WIN_EXE}.sig")"
|
||||
if [ ! -f "$WIN_SIG_FILE" ]; then
|
||||
WIN_SIG_FILE=$(find ../artifacts -name "$(basename "${WIN_EXE}.sig")" | head -n 1)
|
||||
fi
|
||||
WIN_SIG=$(cat "$WIN_SIG_FILE")
|
||||
WIN_URL="https://github.com/${{ github.repository }}/releases/download/ODP/$(basename "$WIN_EXE")"
|
||||
cat << EOF >> latest.json
|
||||
"windows-x86_64": {
|
||||
"signature": "$WIN_SIG",
|
||||
"url": "$WIN_URL"
|
||||
}
|
||||
EOF
|
||||
FIRST_PLATFORM=false
|
||||
fi
|
||||
|
||||
- name: Create latest release
|
||||
MAC_ARM_TAR=$(find ../artifacts -name "*_aarch64.app.tar.gz" | head -n 1)
|
||||
if [ -n "$MAC_ARM_TAR" ]; then
|
||||
if [ "$FIRST_PLATFORM" = false ]; then
|
||||
echo "," >> latest.json
|
||||
fi
|
||||
MAC_ARM_SIG=$(cat "${MAC_ARM_TAR}.sig")
|
||||
MAC_ARM_URL="https://github.com/${{ github.repository }}/releases/download/ODP/$(basename "$MAC_ARM_TAR")"
|
||||
cat << EOF >> latest.json
|
||||
"darwin-aarch64": {
|
||||
"signature": "$MAC_ARM_SIG",
|
||||
"url": "$MAC_ARM_URL"
|
||||
}
|
||||
EOF
|
||||
FIRST_PLATFORM=false
|
||||
fi
|
||||
|
||||
MAC_X64_TAR=$(find ../artifacts -name "*_x86_64.app.tar.gz" | head -n 1)
|
||||
if [ -n "$MAC_X64_TAR" ]; then
|
||||
if [ "$FIRST_PLATFORM" = false ]; then
|
||||
echo "," >> latest.json
|
||||
fi
|
||||
MAC_X64_SIG=$(cat "${MAC_X64_TAR}.sig")
|
||||
MAC_X64_URL="https://github.com/${{ github.repository }}/releases/download/ODP/$(basename "$MAC_X64_TAR")"
|
||||
cat << EOF >> latest.json
|
||||
"darwin-x86_64": {
|
||||
"signature": "$MAC_X64_SIG",
|
||||
"url": "$MAC_X64_URL"
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF >> latest.json
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Generated latest.json for ODP release:"
|
||||
cat latest.json
|
||||
|
||||
- name: Create ODP release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ODP
|
||||
name: Latest Release
|
||||
name: Latest Stable Release
|
||||
body: |
|
||||
This is the latest stable release.
|
||||
For version-specific details, see the corresponding versioned release.
|
||||
**This is the latest stable release (v${{ needs.publish.outputs.version }})**
|
||||
|
||||
This release always points to the most recent stable version.
|
||||
For version-specific details and release notes, see: [${{ needs.publish.outputs.release_name }}](https://github.com/${{ github.repository }}/releases/tag/${{ needs.publish.outputs.versioned_tag }})
|
||||
|
||||
The `latest.json` file in this release is used by the auto-updater to check for new versions.
|
||||
files: ./odp_assets/*
|
||||
prerelease: false
|
||||
draft: ${{ needs.publish.outputs.is_draft == 'true' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user