AFFiNE/.github/workflows/release-desktop-app.yml

191 lines
6.8 KiB
YAML
Raw Normal View History

name: Release Desktop App
2023-01-04 12:16:26 +03:00
on:
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
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-01-04 12:16:26 +03:00
concurrency:
# The concurrency group contains the workflow name and the branch name for
# pull requests or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
2023-01-04 12:16:26 +03:00
cancel-in-progress: true
env:
2023-04-21 19:52:55 +03:00
BUILD_TYPE: ${{ github.event.inputs.build-type }}
jobs:
before-make:
runs-on: ubuntu-latest
environment: ${{ github.ref_name == 'master' && 'production' || 'development' }}
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: generate-assets
working-directory: apps/electron
run: yarn generate-assets
env:
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
AFFINE_GOOGLE_CLIENT_ID: ${{ secrets.AFFINE_GOOGLE_CLIENT_ID }}
AFFINE_GOOGLE_CLIENT_SECRET: ${{ secrets.AFFINE_GOOGLE_CLIENT_SECRET }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
API_SERVER_PROFILE: prod
- name: Upload Artifact (web-static)
uses: actions/upload-artifact@v3
with:
name: before-make-web-static
path: apps/electron/resources/web-static
- name: Upload Artifact (electron dist)
uses: actions/upload-artifact@v3
with:
name: before-make-electron-dist
path: apps/electron/dist
make-distribution:
environment: ${{ github.ref_name == 'master' && 'production' || 'development' }}
strategy:
# all combinations: macos-latest x64, macos-latest arm64, windows-latest x64, ubuntu-latest x64
matrix:
spec:
2023-04-18 19:21:44 +03:00
- { os: macos-latest, platform: macos, arch: x64 }
- { os: macos-latest, platform: macos, arch: arm64 }
- { os: ubuntu-latest, platform: linux, arch: x64 }
- { os: windows-latest, platform: windows, arch: x64 }
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 }}
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
- uses: actions/download-artifact@v3
with:
name: before-make-web-static
path: apps/electron/resources/web-static
- uses: actions/download-artifact@v3
with:
name: before-make-electron-dist
path: apps/electron/dist
2023-03-16 17:58:21 +03:00
- name: Signing By Apple Developer ID
2023-04-18 19:21:44 +03:00
if: ${{ matrix.spec.platform == 'macos' }}
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: make
2023-04-18 19:21:44 +03:00
run: yarn make-${{ matrix.spec.platform }}-${{ matrix.spec.arch }}
2023-03-16 17:58:21 +03:00
working-directory: apps/electron
- name: Save artifacts (mac)
2023-04-18 19:21:44 +03:00
if: ${{ matrix.spec.platform == 'macos' }}
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-03-16 17:58:21 +03:00
- name: Save artifacts (windows)
2023-04-18 19:21:44 +03:00
if: ${{ matrix.spec.platform == 'windows' }}
run: |
mkdir -p builds
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
- name: Save artifacts (linux)
2023-04-18 19:21:44 +03:00
if: ${{ matrix.spec.platform == 'linux' }}
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
path: builds
2023-03-16 17:58:21 +03:00
release:
needs: make-distribution
2023-03-16 17:58:21 +03:00
runs-on: ubuntu-latest
2023-04-18 17:20:34 +03:00
steps:
2023-04-18 17:20:34 +03:00
- name: Download Artifacts (macos-x64)
uses: actions/download-artifact@v3
with:
2023-04-18 17:20:34 +03:00
name: affine-macos-x64-builds
path: ./
- name: Download Artifacts (macos-arm64)
uses: actions/download-artifact@v3
with:
name: affine-macos-arm64-builds
path: ./
- name: Download Artifacts (windows-x64)
uses: actions/download-artifact@v3
with:
name: affine-windows-x64-builds
path: ./
- name: Download Artifacts (linux-x64)
uses: actions/download-artifact@v3
with:
name: affine-linux-x64-builds
path: ./
2023-03-16 17:58:21 +03:00
- name: Create Release Draft
uses: softprops/action-gh-release@v1
env:
2023-04-20 18:34:35 +03:00
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
2023-03-16 17:58:21 +03:00
name: Desktop APP ${{ github.event.inputs.version }}
body: 'TODO: Add release notes here'
draft: ${{ github.event.inputs.is-draft }}
prerelease: ${{ github.event.inputs.is-pre-release }}
files: |
./VERSION
./*.zip
./*.dmg
./*.exe
./*.nupkg
./RELEASES
./*.AppImage
./*.apk