From bcf9e83fd7abf951c936073d6b5f288e55ad0774 Mon Sep 17 00:00:00 2001 From: xurunkang Date: Mon, 14 Feb 2022 12:16:46 +0800 Subject: [PATCH] feat: support automated release by Github CI. (macOS/Linux) --- .github/workflows/release.yml | 122 ++++++++++++++++++++++++++++++++ frontend/app_flowy/CHANGELOG.md | 4 ++ 2 files changed, 126 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 frontend/app_flowy/CHANGELOG.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..f105aa7199 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 \ No newline at end of file diff --git a/frontend/app_flowy/CHANGELOG.md b/frontend/app_flowy/CHANGELOG.md new file mode 100644 index 0000000000..43ee2d21e5 --- /dev/null +++ b/frontend/app_flowy/CHANGELOG.md @@ -0,0 +1,4 @@ +# Release Notes + +## Version 0.0.0 - 2022-22-14 +* 😁 Replace Me.