Files

304 lines
8.5 KiB
YAML

name: Release Builds
on:
workflow_dispatch:
inputs:
source_ref:
description: Branch, tag, or commit to build from
required: true
default: main
type: string
tag_name:
description: Release tag to create or update
required: true
type: string
release_name:
description: Release title
required: true
type: string
release_notes:
description: Optional release notes
required: false
type: string
make_latest:
description: Mark this release as the latest release
required: true
default: true
type: boolean
permissions:
contents: write
jobs:
validate-release:
name: Prepare release input
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.prepare.outputs.package_version }}
source_sha: ${{ steps.prepare.outputs.source_sha }}
steps:
- name: Checkout source ref
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.source_ref }}
fetch-depth: 0
- name: Sync version with release tag
id: prepare
shell: bash
run: |
set -euo pipefail
INPUT_REF="${{ github.event.inputs.source_ref }}"
TAG_VERSION="${{ github.event.inputs.tag_name }}"
TAG_VERSION="${TAG_VERSION#v}"
SOURCE_BRANCH=""
if git ls-remote --exit-code --heads origin "$INPUT_REF" >/dev/null 2>&1; then
SOURCE_BRANCH="$INPUT_REF"
fi
PACKAGE_VERSION=$(node -p "require('./package.json').version")
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
if [ -z "$SOURCE_BRANCH" ]; then
echo "Release tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION), and source_ref '$INPUT_REF' is not a branch that can be updated automatically."
exit 1
fi
npm version "$TAG_VERSION" --no-git-tag-version
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json
git commit -m "chore(release): bump version to v$TAG_VERSION"
git push origin "HEAD:$SOURCE_BRANCH"
PACKAGE_VERSION=$(node -p "require('./package.json').version")
fi
echo "package_version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT"
echo "source_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
build-macos-x64:
name: Build macOS x64
needs: validate-release
runs-on: macos-15-intel
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.validate-release.outputs.source_sha }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: npm ci
- name: Install app dependencies
run: npx electron-builder install-app-deps
- name: Build native macOS helpers
run: npm run build:native-helpers
- name: Build macOS x64
run: |
npx tsc
npx vite build
npx electron-builder --mac dmg --x64 --publish never
mv release/Recordly.dmg release/Recordly-x64.dmg
- name: Upload macOS x64 artifact
uses: actions/upload-artifact@v4
with:
name: macos-x64
path: release/Recordly-x64.dmg
if-no-files-found: error
build-macos-arm64:
name: Build macOS arm64
needs: validate-release
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.validate-release.outputs.source_sha }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Install app dependencies
run: npx electron-builder install-app-deps
- name: Build native macOS helpers
run: npm run build:native-helpers
- name: Build macOS arm64
run: |
npx tsc
npx vite build
npx electron-builder --mac dmg --arm64 --publish never
mv release/Recordly.dmg release/Recordly-arm64.dmg
- name: Upload macOS arm64 artifact
uses: actions/upload-artifact@v4
with:
name: macos-arm64
path: release/Recordly-arm64.dmg
if-no-files-found: error
build-windows-x64:
name: Build Windows x64
needs: validate-release
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.validate-release.outputs.source_sha }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: npm ci
- name: Install app dependencies
run: npx electron-builder install-app-deps
- name: Build Windows x64
shell: pwsh
run: |
npm run build:cursor-monitor
npx tsc
npx vite build
npx electron-builder --win nsis --x64 --publish never
Rename-Item -Path release/Recordly.exe -NewName Recordly-windows-x64.exe
- name: Upload Windows x64 artifact
uses: actions/upload-artifact@v4
with:
name: windows-x64
path: release/Recordly-windows-x64.exe
if-no-files-found: error
build-linux-x64:
name: Build Linux x64
needs: validate-release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.validate-release.outputs.source_sha }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: npm ci
- name: Install app dependencies
run: npx electron-builder install-app-deps
- name: Build Linux x64
run: |
npx tsc
npx vite build
npx electron-builder --linux AppImage --x64 --publish never
mv release/Recordly.AppImage release/Recordly-linux-x64.AppImage
- name: Upload Linux x64 artifact
uses: actions/upload-artifact@v4
with:
name: linux-x64
path: release/Recordly-linux-x64.AppImage
if-no-files-found: error
publish-release:
name: Publish release
needs:
- validate-release
- build-macos-x64
- build-macos-arm64
- build-windows-x64
- build-linux-x64
runs-on: ubuntu-latest
steps:
- name: Download macOS x64 artifact
uses: actions/download-artifact@v4
with:
name: macos-x64
path: release-assets
- name: Download macOS arm64 artifact
uses: actions/download-artifact@v4
with:
name: macos-arm64
path: release-assets
- name: Download Windows x64 artifact
uses: actions/download-artifact@v4
with:
name: windows-x64
path: release-assets
- name: Download Linux x64 artifact
uses: actions/download-artifact@v4
with:
name: linux-x64
path: release-assets
- name: Create or update release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.tag_name }}
commit: ${{ needs.validate-release.outputs.source_sha }}
name: ${{ github.event.inputs.release_name }}
body: ${{ github.event.inputs.release_notes }}
makeLatest: ${{ github.event.inputs.make_latest }}
allowUpdates: true
replacesArtifacts: true
artifactErrorsFailBuild: true
artifacts: |
release-assets/Recordly-arm64.dmg
release-assets/Recordly-x64.dmg
release-assets/Recordly-windows-x64.exe
release-assets/Recordly-linux-x64.AppImage