Skip to content

Release v3.0.9

Release v3.0.9 #81

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: win32-x64
arch: x64
- os: ubuntu-22.04
platform: linux-x64
arch: x64
- os: ubuntu-22.04-arm
platform: linux-arm64
arch: arm64
- os: macos-latest
platform: darwin-arm64
arch: arm64
- os: macos-latest
platform: darwin-x64
arch: x64
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- name: Check out git repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install 7zip (macOS x64 cross-compile)
if: matrix.platform == 'darwin-x64'
run: brew install p7zip
- name: Configure git to use HTTPS
run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/
- name: Cache binary dependencies
uses: actions/cache@v4
id: binary-cache
with:
path: resources
key: binaries-${{ matrix.platform }}-${{ hashFiles('scripts/binary-config.mjs', 'scripts/download-binaries.mjs') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
env:
BINARY_PLATFORM: ${{ matrix.platform }}
SKIP_BINARY_DOWNLOAD: ${{ steps.binary-cache.outputs.cache-hit }}
- name: Build Electron App
run: yarn electron:build --${{ matrix.arch }} --publish never
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MACOSX_DEPLOYMENT_TARGET: '10.15'
VITE_AMPLITUDE_API_KEY: ${{ secrets.VITE_AMPLITUDE_API_KEY }}
VITE_MIXPANEL_TOKEN: ${{ secrets.VITE_MIXPANEL_TOKEN }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.platform }}
path: |
release/*.zip
release/*.dmg
release/*.AppImage
release/*.exe
release/*.yml
release/*.blockmap
retention-days: 1
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out git repository
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release
merge-multiple: true
- name: List release files
run: ls -la release/
- name: Clean up existing release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view ${{ github.ref_name }} > /dev/null 2>&1 || exit 0
echo "Release ${{ github.ref_name }} exists. Cleaning up assets..."
gh release view ${{ github.ref_name }} --json assets --jq '.assets[].name' | while read asset; do
echo "Deleting $asset..."
gh release delete-asset ${{ github.ref_name }} "$asset" -y
done
- name: Extract Changelog for Release
id: changelog
run: |
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}" # Remove 'v' prefix
# Extract English changelog (skip MDX frontmatter)
CHANGELOG_EN=$(awk -v ver="$VERSION" '
/^---$/ { frontmatter++; next }
frontmatter < 2 { next }
/^## \[/ {
if (found) exit
if (index($0, "["ver"]")) found=1
next
}
found { print }
' docs/content/docs/en/changelog.mdx)
# Extract Chinese changelog (skip MDX frontmatter)
CHANGELOG_ZH=$(awk -v ver="$VERSION" '
/^---$/ { frontmatter++; next }
frontmatter < 2 { next }
/^## \[/ {
if (found) exit
if (index($0, "["ver"]")) found=1
next
}
found { print }
' docs/content/docs/zh/changelog.mdx)
# Warn if both changelogs are empty (version not found or format issue)
if [ -z "$CHANGELOG_ZH" ] && [ -z "$CHANGELOG_EN" ]; then
echo "::warning::No changelog found for version $VERSION. Check changelog.mdx format."
CHANGELOG="No changelog available for version $VERSION"
else
# Combine bilingual changelog
CHANGELOG="$CHANGELOG_ZH
---
$CHANGELOG_EN"
fi
# Escape for GitHub Actions output
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
release/*.zip
release/*.dmg
release/*.AppImage
release/*.exe
release/*.yml
release/*.blockmap
body: ${{ steps.changelog.outputs.content }}
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}