diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e31bdef --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,107 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: + - dev + pull_request: + branches: + - dev + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ windows-latest, ubuntu-latest ] + # os: [ windows-latest, ubuntu-latest, macos-latest ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: '9' + + - name: Install dependencies + run: pnpm install + + - name: Compile project + run: pnpm run build:compile + + - name: Build for Windows + if: matrix.os == 'windows-latest' + run: pnpm run build:win + + - name: Build for Linux + if: matrix.os == 'ubuntu-latest' + run: pnpm run build:linux + + # - name: Build for MacOS + # if: matrix.os == 'macos-latest' && (secrets.MACOS_CERTIFICATE && secrets.MACOS_CERTIFICATE_PASSWORD) + # run: pnpm run build:mac + + - name: Upload Artifact for Windows x64 Setup + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v4 + with: + name: easytier-manager-windows-x64_Setup + path: release/*win-x64*.exe + + - name: Upload Artifact for Windows x86 Setup + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v4 + with: + name: easytier-manager-windows-x86_Setup + path: release/*win-ia32*.exe + + - name: Upload Artifact for Windows x64 zip + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v4 + with: + name: easytier-manager-windows-x64 + path: release/*win-x64*.zip + + - name: Upload Artifact for Windows x86 zip + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v4 + with: + name: easytier-manager-windows-x86 + path: release/*win-ia32*.zip + + - name: Upload Artifact for Linux tar.gz + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v4 + with: + name: easytier-manager-linux.tar.gz + path: release/*.tar.gz + + - name: Upload Artifact for Linux AppImage + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v4 + with: + name: easytier-manager-linux-AppImage + path: release/*.AppImage + + - name: Upload Artifact for Linux deb + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v4 + with: + name: easytier-manager-linux-deb + path: release/*.deb + +# - name: Upload Artifacts for MacOS +# if: matrix.os == 'macos-latest' && (secrets.MACOS_CERTIFICATE && secrets.MACOS_CERTIFICATE_PASSWORD) +# uses: actions/upload-artifact@v3 +# with: +# name: macos-build +# path: dist/mac diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c879062 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: Build and Package Electron App + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ windows-latest, ubuntu-latest, macos-latest ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Setup pnpm + run: npm install -g pnpm@9 + + - name: Install dependencies + run: pnpm install + + - name: Compile project + run: pnpm run build:compile + + - name: Build for Windows + if: matrix.os == 'windows-latest' + run: pnpm run build:win + + - name: Build for Linux + if: matrix.os == 'ubuntu-latest' + run: pnpm run build:linux + + - name: Build for MacOS + if: matrix.os == 'macos-latest' + run: pnpm run build:mac + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: release-${{ matrix.os }} + path: release + + - name: Upload to GitHub Releases + if: matrix.os == 'windows-latest' || matrix.os == 'ubuntu-latest' || (matrix.os == 'macos-latest' && env.MACOS_CERTIFICATE) + uses: softprops/action-gh-release@v1 + with: + files: | + release/*.exe + release/*.zip + release/*.deb + release/*.AppImage + release/*.tar.gz + release/*.rpm + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/electron-builder.json5 b/electron-builder.json5 index 58f231e..a464ef5 100644 --- a/electron-builder.json5 +++ b/electron-builder.json5 @@ -21,7 +21,7 @@ // "compression": "store", "artifactName": "${productName}-${os}-${arch}_${version}.${ext}", "directories": { - "output": "release/${version}" + "output": "release" }, "files": [ "dist-electron",