From d5001adeabe0c6ac1a3065bfa54e103372c5b7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Sat, 21 Sep 2024 21:35:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-release.yml | 2 - .github/workflows/build-and-upload.yml | 177 ++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-and-upload.yml diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 01b97e3..a0cda15 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -2,8 +2,6 @@ name: "Build And Release" on: push: - branches: - - master tags: - "*" diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml new file mode 100644 index 0000000..036f239 --- /dev/null +++ b/.github/workflows/build-and-upload.yml @@ -0,0 +1,177 @@ +name: "Build And Upload" + +on: + push: + branches: + - master + +jobs: + # job 1 + build-and-upload: + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: false + matrix: + os: [ + windows, + ubuntu, + macos + ] + steps: + - name: "Checkout" + uses: actions/checkout@v4.1.7 + + - name: "Setup Node.js environment" + uses: actions/setup-node@v4.0.3 + with: + node-version: 16 + registry-url: https://npm.pkg.github.com/ + + - name: "Get package info" + id: package-info + uses: luizfelipelaviola/get-package-info@v1 + with: + path: ./packages/mitmproxy + + - name: "Print" + run: | + echo "version = ${{ steps.package-info.outputs.version }}"; + echo "github.ref_type = ${{ github.ref_type }}"; + echo "github.ref = ${{ github.ref }}"; + echo "github.ref_name = ${{ github.ref_name }}"; + + - name: "npm install -g lerna@6/yarn" + run: | + echo "======================================================================"; + echo "npm install -g lerna@6"; + echo "--------------------"; + npm install -g lerna@6; + + echo "======================================================================"; + echo "npm install -g yarn"; + echo "--------------------"; + npm install -g yarn; + + - name: "npm -v | yarn -v | lerna -v" + run: | + echo "======================================================================"; + echo "npm -v"; + echo "--------------------"; + npm -v; + + echo "======================================================================"; + echo "yarn -v"; + echo "--------------------"; + yarn -v; + + echo "======================================================================"; + echo "lerna -v"; + echo "--------------------"; + lerna -v; + + - name: "lerna bootstrap" + run: | + echo "======================================================================"; + dir || ls -lah; + + echo "======================================================================"; + echo "lerna bootstrap --npm-client=yarn"; + echo "--------------------"; + lerna bootstrap --npm-client=yarn; + + - name: "npm run electron:build" + run: | + echo "======================================================================"; + echo "cd packages/gui"; + echo "--------------------"; + cd packages/gui; + dir || ls -lah; + + echo "======================================================================"; + echo "npm run electron:build"; + echo "--------------------"; + npm run electron:build; + + echo "======================================================================"; + echo "cd dist_electron"; + echo "--------------------"; + cd dist_electron; + dir || ls -lah; + + echo "======================================================================"; + echo "cd ../../../"; + echo "--------------------"; + cd ../../../; + dir || ls -lah; + + - name: "Upload DevSidecar-${{ steps.package-info.outputs.version }}.exe - Windows" + uses: actions/upload-artifact@v4.4.0 + if: ${{ matrix.os == 'windows' }} + with: + path: packages/gui/dist_electron/DevSidecar-${{ steps.package-info.outputs.version }}.exe + name: "DevSidecar-${{ steps.package-info.outputs.version }}.exe" + if-no-files-found: error + - name: "Upload DevSidecar-${{ steps.package-info.outputs.version }}.deb - Ubuntu" + uses: actions/upload-artifact@v4.4.0 + if: ${{ matrix.os == 'ubuntu' }} + with: + path: packages/gui/dist_electron/DevSidecar-${{ steps.package-info.outputs.version }}.deb + name: "DevSidecar-${{ steps.package-info.outputs.version }}.deb" + if-no-files-found: error + - name: "Upload DevSidecar-${{ steps.package-info.outputs.version }}.AppImage - Ubuntu" + uses: actions/upload-artifact@v4.4.0 + if: ${{ matrix.os == 'ubuntu' }} + with: + path: packages/gui/dist_electron/DevSidecar-${{ steps.package-info.outputs.version }}.AppImage + name: "DevSidecar-${{ steps.package-info.outputs.version }}.AppImage" + if-no-files-found: error + - name: "Upload DevSidecar-${{ steps.package-info.outputs.version }}.dmg - Mac" + uses: actions/upload-artifact@v4.4.0 + if: ${{ matrix.os == 'macos' }} + with: + path: packages/gui/dist_electron/DevSidecar-${{ steps.package-info.outputs.version }}.dmg + name: "DevSidecar-${{ steps.package-info.outputs.version }}.dmg" + if-no-files-found: error + + # job 2 + download-and-release: + runs-on: ubuntu-latest + needs: + - build-and-upload + steps: + - name: "Checkout" + uses: actions/checkout@v4.1.7 + + - name: "Get package info" + id: package-info + uses: luizfelipelaviola/get-package-info@v1 + with: + path: ./packages/mitmproxy + + - name: "Make 'release' dir" + run: mkdir release + + - name: "Download DevSidecar-${{ steps.package-info.outputs.version }}.exe - Windows" + uses: actions/download-artifact@v4.1.8 + with: + name: DevSidecar-${{ steps.package-info.outputs.version }}.exe + path: release + - name: "Download DevSidecar-${{ steps.package-info.outputs.version }}.deb - Ubuntu" + uses: actions/download-artifact@v4.1.8 + with: + name: DevSidecar-${{ steps.package-info.outputs.version }}.deb + path: release + - name: "Download DevSidecar-${{ steps.package-info.outputs.version }}.AppImage - Ubuntu" + uses: actions/download-artifact@v4.1.8 + with: + name: DevSidecar-${{ steps.package-info.outputs.version }}.AppImage + path: release + - name: "Download DevSidecar-${{ steps.package-info.outputs.version }}.dmg - Mac" + uses: actions/download-artifact@v4.1.8 + with: + name: DevSidecar-${{ steps.package-info.outputs.version }}.dmg + path: release + + - name: "Print files from 'release' dir" + run: | + ls -lah release;