mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
110 lines
3.2 KiB
YAML
110 lines
3.2 KiB
YAML
name: Release App
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: App Vesion
|
|
required: false
|
|
default: 0.1.0
|
|
|
|
permissions:
|
|
actions: write
|
|
contents: write
|
|
security-events: write
|
|
|
|
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 }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
create-release:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
release_id: ${{ steps.create-release.outputs.result }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: setup node
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 16
|
|
- name: create release
|
|
id: create-release
|
|
uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
const { data } = await github.rest.repos.createRelease({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
tag_name: `affine-client-v${{ github.event.inputs.version }}`,
|
|
name: `Affine Client v${{ github.event.inputs.version }}`,
|
|
body: 'Take a look at the assets to download and install this app.',
|
|
draft: true,
|
|
prerelease: false
|
|
})
|
|
return data.id
|
|
|
|
build-tauri:
|
|
needs: create-release
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform: [macos-latest, ubuntu-latest, windows-latest]
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: pnpm/action-setup@v2
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'pnpm'
|
|
- run: pnpm i
|
|
|
|
- name: install dependencies (ubuntu only)
|
|
if: matrix.platform == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
|
|
- name: install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Get rust cache
|
|
uses: Swatinem/rust-cache@v2
|
|
id: rust-cache
|
|
with:
|
|
workspaces: |
|
|
apps/desktop/src-tauri
|
|
|
|
- name: Upload to release on git tag Or output artifact path on nightly
|
|
uses: tauri-apps/tauri-action@v0
|
|
id: tauri-action
|
|
env:
|
|
CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
releaseId: ${{ needs.create-release.outputs.release_id }}
|
|
|
|
publish-release:
|
|
runs-on: ubuntu-latest
|
|
needs: [create-release, build-tauri]
|
|
|
|
steps:
|
|
- name: publish pre release
|
|
id: publish-pre-release
|
|
uses: actions/github-script@v6
|
|
env:
|
|
release_id: ${{ needs.create-release.outputs.release_id }}
|
|
with:
|
|
script: |
|
|
github.rest.repos.updateRelease({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
release_id: process.env.release_id,
|
|
draft: false,
|
|
prerelease: true
|
|
})
|