feat: support automated release by Github CI. (macOS/Linux)

This commit is contained in:
xurunkang 2022-02-14 12:16:46 +08:00
parent fa33f0c21b
commit bcf9e83fd7
2 changed files with 126 additions and 0 deletions

122
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,122 @@
name: release
on:
push:
tags:
- '*'
jobs:
create-release:
runs-on: ubuntu-latest
env:
RELEASE_NOTES_PATH: /tmp/release_notes
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build release notes
working-directory: frontend/app_flowy
run: |
touch ${{ env.RELEASE_NOTES_PATH }}
cat CHANGELOG.md | sed -e '/./{H;$!d;}' -e "x;/##\ Version\ ${{ github.ref_name }}/"'!d;' >> ${{ env.RELEASE_NOTES_PATH }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: ${{ env.RELEASE_NOTES_PATH }}
build-linux-x86:
runs-on: ubuntu-latest
needs: create-release
env:
LINUX_APP_RELEASE_PATH: frontend/app_flowy/product/${{ github.ref_name }}/linux/Release
LINUX_ZIP_NAME: AppFlowy-linux-x86.tar.gz
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup environment - Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Setup environment - Rust and Cargo
working-directory: frontend
run: |
sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
sudo apt-get update
sudo apt-get install -y build-essential libsqlite3-dev libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
make install_rust
source $HOME/.cargo/env
cargo install --force cargo-make
cargo install --force duckscript_cli
cargo make flowy_dev
- name: Build Linux app
working-directory: frontend
run: |
flutter config --enable-linux-desktop
cargo make --profile production-linux-x86 appflowy
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_ZIP_NAME }}
asset_name: ${{ env.LINUX_ZIP_NAME }}
asset_content_type: application/octet-stream
build-macos:
runs-on: macos-latest
needs: create-release
env:
MACOS_APP_RELEASE_PATH: frontend/app_flowy/product/${{ github.ref_name }}/macos/Release
MACOS_ZIP_NAME: Appflowy-macos-x86.zip
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup environment - Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Setup environment - Rust and Cargo
working-directory: frontend
run: |
make install_rust
source $HOME/.cargo/env
cargo install --force cargo-make
cargo install --force duckscript_cli
cargo make flowy_dev
- name: Build macOS app
working-directory: frontend
run: |
flutter config --enable-macos-desktop
cargo make --profile production-mac-x86 appflowy
- name: Archive macOS app
working-directory: ${{ env.MACOS_APP_RELEASE_PATH }}
run: zip -qr ${{ env.MACOS_ZIP_NAME }} AppFlowy.app
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.MACOS_APP_RELEASE_PATH }}/${{ env.MACOS_ZIP_NAME }}
asset_name: ${{ env.MACOS_ZIP_NAME }}
asset_content_type: application/octet-stream

View File

@ -0,0 +1,4 @@
# Release Notes
## Version 0.0.0 - 2022-22-14
* 😁 Replace Me.