2023-03-28 09:08:17 +03:00
|
|
|
name: Release Desktop App
|
2023-01-04 12:16:26 +03:00
|
|
|
|
|
|
|
on:
|
2023-06-28 18:53:32 +03:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v[0-9]+.[0-9]+.[0-9]+-canary.[0-9]+'
|
2023-03-11 15:35:38 +03:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
version:
|
2023-03-16 17:58:21 +03:00
|
|
|
description: App Version
|
|
|
|
required: true
|
2023-03-17 11:23:58 +03:00
|
|
|
default: 0.0.0
|
2023-03-16 17:58:21 +03:00
|
|
|
is-draft:
|
|
|
|
description: 'Draft Release?'
|
|
|
|
type: boolean
|
|
|
|
required: true
|
|
|
|
default: true
|
|
|
|
is-pre-release:
|
|
|
|
description: 'Pre Release? (labeled as "PreRelease")'
|
|
|
|
type: boolean
|
|
|
|
required: true
|
|
|
|
default: true
|
2023-04-21 19:52:55 +03:00
|
|
|
build-type:
|
|
|
|
description: 'Build Type (canary, beta or stable)'
|
|
|
|
type: string
|
2023-04-17 19:32:10 +03:00
|
|
|
required: true
|
2023-04-21 19:52:55 +03:00
|
|
|
default: canary
|
2023-01-04 12:16:26 +03:00
|
|
|
|
2023-02-14 09:51:05 +03:00
|
|
|
permissions:
|
|
|
|
actions: write
|
|
|
|
contents: write
|
|
|
|
security-events: write
|
|
|
|
|
2023-04-17 19:32:10 +03:00
|
|
|
env:
|
2023-06-28 18:53:32 +03:00
|
|
|
BUILD_TYPE: ${{ github.event.inputs.build-type || (github.ref_type == 'tag' && contains(github.ref, 'canary') && 'canary') }}
|
2023-05-10 13:38:23 +03:00
|
|
|
DEBUG: napi:*
|
|
|
|
APP_NAME: affine
|
|
|
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
2023-04-17 19:32:10 +03:00
|
|
|
|
2023-04-04 15:40:07 +03:00
|
|
|
jobs:
|
2023-04-18 12:50:29 +03:00
|
|
|
before-make:
|
|
|
|
runs-on: ubuntu-latest
|
2023-06-28 19:32:39 +03:00
|
|
|
environment: production
|
2023-06-28 18:53:32 +03:00
|
|
|
outputs:
|
|
|
|
RELEASE_VERSION: ${{ steps.get-canary-version.outputs.RELEASE_VERSION }}
|
2023-04-18 12:50:29 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
2023-06-28 18:53:32 +03:00
|
|
|
- name: Get canary version
|
|
|
|
id: get-canary-version
|
|
|
|
if: ${{ github.ref_type == 'tag' }}
|
|
|
|
run: |
|
2023-06-28 19:26:48 +03:00
|
|
|
TAG_VERSION=${GITHUB_REF#refs/tags/v}
|
2023-06-28 19:31:33 +03:00
|
|
|
PACKAGE_VERSION=$(node -p "require('./apps/electron/package.json').version")
|
2023-06-28 18:53:32 +03:00
|
|
|
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
|
|
|
|
echo "Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-06-28 19:31:33 +03:00
|
|
|
echo "RELEASE_VERSION=$(node -p "require('./apps/electron/package.json').version")" >> $GITHUB_OUTPUT
|
2023-04-18 12:50:29 +03:00
|
|
|
- name: generate-assets
|
2023-05-17 12:22:49 +03:00
|
|
|
run: yarn workspace @affine/electron generate-assets
|
2023-04-18 12:50:29 +03:00
|
|
|
env:
|
|
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
|
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
2023-06-28 18:53:32 +03:00
|
|
|
RELEASE_VERSION: ${{ github.event.inputs.version || steps.get-canary-version.outputs.RELEASE_VERSION }}
|
2023-04-18 12:50:29 +03:00
|
|
|
|
2023-07-18 19:53:10 +03:00
|
|
|
- name: Upload core artifact
|
2023-04-18 12:50:29 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-07-18 19:53:10 +03:00
|
|
|
name: core
|
2023-04-18 12:50:29 +03:00
|
|
|
path: apps/electron/resources/web-static
|
|
|
|
|
|
|
|
make-distribution:
|
2023-06-28 19:32:39 +03:00
|
|
|
environment: production
|
2023-04-18 12:50:29 +03:00
|
|
|
strategy:
|
|
|
|
# all combinations: macos-latest x64, macos-latest arm64, windows-latest x64, ubuntu-latest x64
|
|
|
|
matrix:
|
|
|
|
spec:
|
2023-05-10 13:38:23 +03:00
|
|
|
- {
|
|
|
|
os: macos-latest,
|
2023-05-17 12:22:49 +03:00
|
|
|
platform: darwin,
|
2023-05-10 13:38:23 +03:00
|
|
|
arch: x64,
|
|
|
|
target: x86_64-apple-darwin,
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
os: macos-latest,
|
2023-05-17 12:22:49 +03:00
|
|
|
platform: darwin,
|
2023-05-10 13:38:23 +03:00
|
|
|
arch: arm64,
|
|
|
|
target: aarch64-apple-darwin,
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
os: ubuntu-latest,
|
|
|
|
platform: linux,
|
|
|
|
arch: x64,
|
|
|
|
target: x86_64-unknown-linux-gnu,
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
os: windows-latest,
|
2023-05-17 12:22:49 +03:00
|
|
|
platform: win32,
|
2023-05-10 13:38:23 +03:00
|
|
|
arch: x64,
|
|
|
|
target: x86_64-pc-windows-msvc,
|
|
|
|
}
|
2023-04-18 12:50:29 +03:00
|
|
|
runs-on: ${{ matrix.spec.os }}
|
|
|
|
needs: before-make
|
2023-04-12 18:23:47 +03:00
|
|
|
env:
|
|
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
|
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
|
|
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
2023-04-18 12:50:29 +03:00
|
|
|
SKIP_GENERATE_ASSETS: 1
|
2023-03-16 17:58:21 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-03-24 18:44:14 +03:00
|
|
|
- name: Setup Node.js
|
|
|
|
uses: ./.github/actions/setup-node
|
2023-05-10 13:38:23 +03:00
|
|
|
- name: Build AFFiNE native
|
|
|
|
uses: ./.github/actions/build-rust
|
|
|
|
with:
|
|
|
|
target: ${{ matrix.spec.target }}
|
2023-06-19 12:38:26 +03:00
|
|
|
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
2023-04-18 12:50:29 +03:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-07-18 19:53:10 +03:00
|
|
|
name: core
|
2023-04-18 12:50:29 +03:00
|
|
|
path: apps/electron/resources/web-static
|
2023-05-17 12:22:49 +03:00
|
|
|
|
2023-06-30 12:06:44 +03:00
|
|
|
- name: Build Plugins
|
|
|
|
run: yarn run build:plugins
|
|
|
|
|
|
|
|
- name: Build Desktop Layers
|
2023-07-01 11:34:30 +03:00
|
|
|
run: yarn workspace @affine/electron build
|
2023-03-16 17:58:21 +03:00
|
|
|
|
2023-04-04 00:39:25 +03:00
|
|
|
- name: Signing By Apple Developer ID
|
2023-05-17 12:22:49 +03:00
|
|
|
if: ${{ matrix.spec.platform == 'darwin' }}
|
2023-04-04 00:39:25 +03:00
|
|
|
uses: apple-actions/import-codesign-certs@v2
|
|
|
|
with:
|
|
|
|
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
|
|
|
|
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
|
|
|
|
|
2023-04-18 12:50:29 +03:00
|
|
|
- name: make
|
2023-05-17 12:22:49 +03:00
|
|
|
run: yarn workspace @affine/electron make --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }}
|
2023-03-11 15:35:38 +03:00
|
|
|
|
2023-04-18 12:50:29 +03:00
|
|
|
- name: Save artifacts (mac)
|
2023-05-17 12:22:49 +03:00
|
|
|
if: ${{ matrix.spec.platform == 'darwin' }}
|
2023-03-16 17:58:21 +03:00
|
|
|
run: |
|
|
|
|
mkdir -p builds
|
2023-04-18 19:43:51 +03:00
|
|
|
mv apps/electron/out/*/make/*.dmg ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.dmg
|
2023-05-03 07:13:40 +03:00
|
|
|
mv apps/electron/out/*/make/zip/darwin/${{ matrix.spec.arch }}/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-macos-${{ matrix.spec.arch }}.zip
|
2023-04-18 12:50:29 +03:00
|
|
|
- name: Save artifacts (windows)
|
2023-05-17 12:22:49 +03:00
|
|
|
if: ${{ matrix.spec.platform == 'win32' }}
|
2023-03-18 16:43:39 +03:00
|
|
|
run: |
|
|
|
|
mkdir -p builds
|
2023-04-17 19:32:10 +03:00
|
|
|
mv apps/electron/out/*/make/zip/win32/x64/AFFiNE*-win32-x64-*.zip ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.zip
|
|
|
|
mv apps/electron/out/*/make/squirrel.windows/x64/*.exe ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.exe
|
|
|
|
mv apps/electron/out/*/make/squirrel.windows/x64/*.msi ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.msi
|
|
|
|
mv apps/electron/out/*/make/squirrel.windows/x64/*.nupkg ./builds/affine-${{ env.BUILD_TYPE }}-windows-x64.nupkg
|
2023-03-18 16:43:39 +03:00
|
|
|
|
2023-04-18 12:50:29 +03:00
|
|
|
- name: Save artifacts (linux)
|
2023-04-18 19:21:44 +03:00
|
|
|
if: ${{ matrix.spec.platform == 'linux' }}
|
2023-04-17 19:32:10 +03:00
|
|
|
run: |
|
|
|
|
mkdir -p builds
|
|
|
|
mv apps/electron/out/*/make/zip/linux/x64/*.zip ./builds/affine-${{ env.BUILD_TYPE }}-linux-x64.zip
|
|
|
|
|
|
|
|
- name: Upload Artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-04-18 19:21:44 +03:00
|
|
|
name: affine-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}-builds
|
2023-04-17 19:32:10 +03:00
|
|
|
path: builds
|
|
|
|
|
2023-03-16 17:58:21 +03:00
|
|
|
release:
|
2023-06-28 18:53:32 +03:00
|
|
|
needs: [before-make, make-distribution]
|
2023-03-16 17:58:21 +03:00
|
|
|
runs-on: ubuntu-latest
|
2023-04-18 17:20:34 +03:00
|
|
|
|
2023-03-11 15:35:38 +03:00
|
|
|
steps:
|
2023-05-17 12:22:49 +03:00
|
|
|
- uses: actions/checkout@v3
|
2023-04-18 17:20:34 +03:00
|
|
|
- name: Download Artifacts (macos-x64)
|
2023-04-17 19:32:10 +03:00
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-05-17 12:22:49 +03:00
|
|
|
name: affine-darwin-x64-builds
|
2023-04-18 17:20:34 +03:00
|
|
|
path: ./
|
|
|
|
- name: Download Artifacts (macos-arm64)
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-05-17 12:22:49 +03:00
|
|
|
name: affine-darwin-arm64-builds
|
2023-04-18 17:20:34 +03:00
|
|
|
path: ./
|
|
|
|
- name: Download Artifacts (windows-x64)
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-05-17 12:22:49 +03:00
|
|
|
name: affine-win32-x64-builds
|
2023-04-18 17:20:34 +03:00
|
|
|
path: ./
|
|
|
|
- name: Download Artifacts (linux-x64)
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: affine-linux-x64-builds
|
2023-04-17 19:32:10 +03:00
|
|
|
path: ./
|
2023-05-03 07:13:40 +03:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
- name: Generate Release yml
|
|
|
|
run: |
|
2023-05-17 12:22:49 +03:00
|
|
|
cp ./apps/electron/scripts/generate-yml.js .
|
|
|
|
node generate-yml.js
|
|
|
|
env:
|
2023-06-28 20:20:35 +03:00
|
|
|
RELEASE_VERSION: ${{ github.event.inputs.version || needs.before-make.outputs.RELEASE_VERSION }}
|
2023-03-16 17:58:21 +03:00
|
|
|
- name: Create Release Draft
|
|
|
|
uses: softprops/action-gh-release@v1
|
2023-03-11 15:35:38 +03:00
|
|
|
env:
|
2023-04-20 18:34:35 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
2023-02-14 18:18:47 +03:00
|
|
|
with:
|
2023-06-28 20:20:35 +03:00
|
|
|
name: ${{ github.event.inputs.version || needs.before-make.outputs.RELEASE_VERSION }}
|
2023-06-28 18:53:32 +03:00
|
|
|
body: ''
|
2023-06-28 20:20:35 +03:00
|
|
|
draft: ${{ github.event.inputs.is-draft || true }}
|
2023-06-28 18:53:32 +03:00
|
|
|
prerelease: ${{ github.event.inputs.is-pre-release || needs.before-make.outputs.version }}
|
2023-03-16 17:58:21 +03:00
|
|
|
files: |
|
|
|
|
./VERSION
|
|
|
|
./*.zip
|
|
|
|
./*.dmg
|
|
|
|
./*.exe
|
|
|
|
./*.nupkg
|
|
|
|
./RELEASES
|
|
|
|
./*.AppImage
|
|
|
|
./*.apk
|
2023-05-03 07:13:40 +03:00
|
|
|
./*.yml
|