From 26bcd862c056f15c608b32a06bab071d81830264 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sun, 8 Jan 2023 17:11:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0release=20=E5=88=86?= =?UTF-8?q?=E6=94=AF=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pake_build.yaml | 45 +------ .github/workflows/pake_build_with_cache.yaml | 125 +++++++++++++++++++ 2 files changed, 128 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/pake_build_with_cache.yaml diff --git a/.github/workflows/pake_build.yaml b/.github/workflows/pake_build.yaml index d988116..f9fbdf8 100644 --- a/.github/workflows/pake_build.yaml +++ b/.github/workflows/pake_build.yaml @@ -1,9 +1,9 @@ -name: Build App +name: Build App with Cache on: push: # Sequence of patterns matched against refs/tags - tags: - - "V*" + branches: + - release jobs: build: @@ -47,37 +47,12 @@ jobs: override: true target: ${{ matrix.target }} - - name: "Cache Restore" - uses: Swatinem/rust-cache@v2 - with: - prefix-key: "" - shared-key: "" - key: "" - env-vars: "" - workspaces: "src-tauri" - cache-directories: "" - cache-targets: "" - cache-on-failure: "" - save-if: "false" - # for more to see: https://github.com/Swatinem/rust-cache - - name: install dependencies (ubuntu only) if: matrix.os == 'ubuntu-20.04' uses: awalsh128/cache-apt-pkgs-action@latest with: packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra version: 1.1 - - - name: rust cache restore - uses: ylemkimon/cache-restore@v2 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - src-tauri/target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: build for Ubuntu if: matrix.os == 'ubuntu-20.04' @@ -123,17 +98,3 @@ jobs: # with: # name: ${{ matrix.archive-name }} # path: src-tauri/${{ matrix.archive-name }} - - # - name: "Store cache" - # uses: Swatinem/rust-cache@v2 - # with: - # prefix-key: "" - # shared-key: "" - # key: "" - # env-vars: "" - # workspaces: "src-tauri" - # cache-directories: "" - # cache-targets: "" - # cache-on-failure: "" - # save-if: "" - # for more to see: https://github.com/Swatinem/rust-cache diff --git a/.github/workflows/pake_build_with_cache.yaml b/.github/workflows/pake_build_with_cache.yaml new file mode 100644 index 0000000..da68b26 --- /dev/null +++ b/.github/workflows/pake_build_with_cache.yaml @@ -0,0 +1,125 @@ +name: Build App +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - "V*" + +jobs: + build: + name: build + runs-on: ${{ matrix.os }} + strategy: + matrix: + build: [linux, windows, macos] + include: + - build: linux + os: ubuntu-20.04 + rust: stable + target: x86_64-unknown-linux-musl + # archive-name: target-linux.tar.gz + - build: windows + os: windows-latest + rust: stable-x86_64-msvc + target: x86_64-pc-windows-msvc + # archive-name: target-windows.tar.gz + - build: macos + os: macos-latest + rust: stable + target: x86_64-apple-darwin + # archive-name: target-macos.tar.gz + fail-fast: false + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: install node + uses: actions/setup-node@v1 + with: + node-version: 18 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + profile: minimal + override: true + target: ${{ matrix.target }} + + - name: install dependencies (ubuntu only) + if: matrix.os == 'ubuntu-20.04' + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra + version: 1.1 + + - name: rust cache restore + uses: ylemkimon/cache-restore@v2 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + src-tauri/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: build for Ubuntu + if: matrix.os == 'ubuntu-20.04' + run: npm run build:all-unix + + - name: build for MacOS + if: matrix.os == 'macos-latest' + run: | + rustup target add aarch64-apple-darwin + npm run build:all-unix + + - name: build for windows + if: matrix.os == 'windows-latest' + run: | + npm run build:all-windows + + - name: Upload files + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -L https://github.com/probonopd/uploadtool/raw/master/upload.sh --output upload.sh + bash upload.sh output/*/*.* + + - name: rust cache store + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + src-tauri/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + # - name: Build archive + # shell: bash + # run: | + # cd src-tauri + # tar -czf "${{ matrix.archive-name }}" target + + # - name: Upload archive + # uses: actions/upload-artifact@v1 + # with: + # name: ${{ matrix.archive-name }} + # path: src-tauri/${{ matrix.archive-name }} + + # - name: "Store cache" + # uses: Swatinem/rust-cache@v2 + # with: + # prefix-key: "" + # shared-key: "" + # key: "" + # env-vars: "" + # workspaces: "src-tauri" + # cache-directories: "" + # cache-targets: "" + # cache-on-failure: "" + # save-if: "" + # for more to see: https://github.com/Swatinem/rust-cache From d9b35cfacf7a194d9e5028171485e1e1c2969a02 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sun, 8 Jan 2023 17:45:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0release=20=E5=88=86?= =?UTF-8?q?=E6=94=AF=E7=BC=93=E5=AD=98=E6=81=A2=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pake_build.yaml | 29 ++------------------ .github/workflows/pake_build_with_cache.yaml | 20 ++------------ 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/.github/workflows/pake_build.yaml b/.github/workflows/pake_build.yaml index f9fbdf8..3c9653b 100644 --- a/.github/workflows/pake_build.yaml +++ b/.github/workflows/pake_build.yaml @@ -1,9 +1,9 @@ -name: Build App with Cache +name: Build App on: push: # Sequence of patterns matched against refs/tags - branches: - - release + tags: + - "V*" jobs: build: @@ -75,26 +75,3 @@ jobs: run: | curl -L https://github.com/probonopd/uploadtool/raw/master/upload.sh --output upload.sh bash upload.sh output/*/*.* - - - name: rust cache store - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - src-tauri/target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - # - name: Build archive - # shell: bash - # run: | - # cd src-tauri - # tar -czf "${{ matrix.archive-name }}" target - - # - name: Upload archive - # uses: actions/upload-artifact@v1 - # with: - # name: ${{ matrix.archive-name }} - # path: src-tauri/${{ matrix.archive-name }} diff --git a/.github/workflows/pake_build_with_cache.yaml b/.github/workflows/pake_build_with_cache.yaml index da68b26..f0e1c77 100644 --- a/.github/workflows/pake_build_with_cache.yaml +++ b/.github/workflows/pake_build_with_cache.yaml @@ -1,9 +1,9 @@ -name: Build App +name: Build App with Cache on: push: # Sequence of patterns matched against refs/tags - tags: - - "V*" + branches: + - release jobs: build: @@ -109,17 +109,3 @@ jobs: # with: # name: ${{ matrix.archive-name }} # path: src-tauri/${{ matrix.archive-name }} - - # - name: "Store cache" - # uses: Swatinem/rust-cache@v2 - # with: - # prefix-key: "" - # shared-key: "" - # key: "" - # env-vars: "" - # workspaces: "src-tauri" - # cache-directories: "" - # cache-targets: "" - # cache-on-failure: "" - # save-if: "" - # for more to see: https://github.com/Swatinem/rust-cache