Skip to content

Commit

Permalink
add release action
Browse files Browse the repository at this point in the history
  • Loading branch information
m1911star committed Aug 8, 2022
1 parent 54837ad commit 43b4073
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 3 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: "release"
on:
workflow_dispatch:
inputs:
version:
description: App Vesion
required: false
default: v0.1.0

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-${{ 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@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: install node tools
run: |
npm install -g pnpm yarn
- name: install app dependencies & build AFFiNE
run: |
yarn
git submodule update --init --recursive
cd ./affine
pnpm i
pnpm build:local
cd ../tauri
cargo install --path .
cd ..
- uses: tauri-apps/tauri-action@v0
env:
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 release
id: publish-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: false
})
5 changes: 2 additions & 3 deletions .github/workflows/build.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "test-on-build"
on:
push:
branches:
- main
- dev

jobs:
test-tauri:
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
- name: install node tools
run: |
npm install -g pnpm yarn
- name: install app dependencies
- name: install app dependencies & build AFFiNE
run: |
yarn
git submodule update --init --recursive
Expand All @@ -40,7 +40,6 @@ jobs:
cd ../tauri
cargo install --path .
cd ..
yarn run build:client
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 43b4073

Please sign in to comment.