From e7a41e336a2262a5904399ed6718327225ce12e0 Mon Sep 17 00:00:00 2001 From: trivernis Date: Mon, 17 Jan 2022 19:42:02 +0100 Subject: [PATCH] Improve release workflow Signed-off-by: trivernis --- .github/workflows/release.yml | 136 ++++++++++++++++++++++++++++++++-- .gitignore | 3 + 2 files changed, 133 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7657c6..64fea3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,17 +3,141 @@ name: Create pre-release on: push: branches: - - "master" + - main jobs: - pre-release: - name: Pre Release + create-release-draft: + name: pre-release runs-on: ubuntu-latest + outputs: + release_upload_url: ${{ steps.create_release.outputs.upload_url }} steps: - - uses: marvinpinto/action-automatic-releases@latest + - uses: actions/checkout@v2 + if: ${{ !env.ACT }} + + - id: create_release + uses: marvinpinto/action-automatic-releases@latest + if: ${{ !env.ACT }} with: repo_token: ${{ secrets.GITHUB_TOKEN }} automatic_release_tag: latest - prerelease: true + draft: true title: Latest Pre-Release files: | - LICENSE \ No newline at end of file + LICENSE + build-daemon: + needs: create-release-draft + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: mediarepo-daemon + steps: + - uses: actions/checkout@v2 + if: ${{ !env.ACT }} + + - name: Cache build data + if: ${{ !env.ACT }} + uses: actions/cache@v2 + with: + path: | + target + ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build Daemon + run: cargo build --release --no-default-features + + - uses: papeloto/action-zip@v1 + with: + files: target/release/mediarepo-daemon target/release/mediarepo-daemon.exe + dest: mediarepo-daemon-${{ runner.os }}.zip + + - 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-draft.outputs.release_upload_url }} + asset_path: ./mediarepo-daemon-${{ runner.os }}.zip + asset_name: mediarepo-daemon-${{ runner.os }}.zip + asset_content_type: application/zip + + build-ui: + needs: create-release-draft + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: mediarepo-ui + steps: + - uses: actions/checkout@v2 + if: ${{ !env.ACT }} + + - name: Cache Dependencies + if: ${{ !env.ACT }} + id: cache-dependencies + uses: actions/cache@v2 + with: + path: | + node_modules + src-tauri/target + /home/runner/.cargo + ~/.cargo + key: ${{ runner.os }}-release-dependencies-${{ hashFiles('src-tauri/Cargo.lock') }}-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-release-dependencies- + ${{ runner.os }}-dependencies- + + - name: Use Node.js 16 + uses: actions/setup-node@v1 + with: + node-version: 16 + + - name: Install Tauri + run: cargo install tauri-cli --git https://github.com/tauri-apps/tauri + + - name: Install Angular CLI + run: npm install -g @angular/cli + + - name: Install yarn + run: npm install -g yarn + + - name: Install dependencies + run: yarn install + + - name: Install OS-specific dependencies + uses: knicknic/os-specific-run@v1.0.3 + with: + linux: | + sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev -y + + - name: Build project + run: cargo tauri build + + - uses: papeloto/action-zip@v1 + with: + files: src-tauri/target/release/bundle src-tauri/target/release/mediarepo-ui src-tauri/target/release/mediarepo-ui.exe + dest: mediarepo-ui-${{ runner.os }}.zip + + - 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-draft.outputs.release_upload_url }} + asset_path: ./mediarepo-ui-${{ runner.os }}.zip + asset_name: mediarepo-ui-${{ runner.os }}.zip + asset_content_type: application/zip \ No newline at end of file diff --git a/.gitignore b/.gitignore index 86cf28c..e73670f 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ mediarepo-ui/.idea # System Files .DS_Store Thumbs.db + +# other +*.zip \ No newline at end of file