diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index afd9e7d7..6dbe4eb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,57 +30,58 @@ jobs: S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} S3_BUILDS_BUCKET_NAME: ${{ secrets.S3_BUILDS_BUCKET_NAME }} BUILD_WEBHOOK_URL: ${{ secrets.BUILD_WEBHOOK_URL }} + GITHUB_ACTOR: ${{ github.actor }} run: node scripts/upload-build.cjs - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: 3.9 + # - name: Install Python + # uses: actions/setup-python@v5 + # with: + # python-version: 3.9 - - name: Install dependencies - run: pip install -r requirements.txt + # - name: Install dependencies + # run: pip install -r requirements.txt - - name: Build with cx_Freeze - run: python torrent-client/setup.py build + # - name: Build with cx_Freeze + # run: python torrent-client/setup.py build - - name: Build Linux - if: matrix.os == 'ubuntu-latest' - run: | - sudo apt-get update - sudo apt-get install -y libarchive-tools - yarn build:linux - env: - MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_STAGING_API_URL }} - MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }} - MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }} - MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }} - RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }} - RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.RENDERER_VITE_EXTERNAL_RESOURCES_URL }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Build Linux + # if: matrix.os == 'ubuntu-latest' + # run: | + # sudo apt-get update + # sudo apt-get install -y libarchive-tools + # yarn build:linux + # env: + # MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_STAGING_API_URL }} + # MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }} + # MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }} + # MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }} + # RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }} + # RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.RENDERER_VITE_EXTERNAL_RESOURCES_URL }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Build Windows - if: matrix.os == 'windows-latest' - run: yarn build:win - env: - MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_STAGING_API_URL }} - MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }} - MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }} - MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }} - RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }} - RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.RENDERER_VITE_EXTERNAL_RESOURCES_URL }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Build Windows + # if: matrix.os == 'windows-latest' + # run: yarn build:win + # env: + # MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_STAGING_API_URL }} + # MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }} + # MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }} + # MAIN_VITE_ANALYTICS_API_URL: ${{ vars.MAIN_VITE_ANALYTICS_API_URL }} + # RENDERER_VITE_INTERCOM_APP_ID: ${{ vars.RENDERER_VITE_INTERCOM_APP_ID }} + # RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.RENDERER_VITE_EXTERNAL_RESOURCES_URL }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create artifact - uses: actions/upload-artifact@v4 - with: - name: Build-${{ matrix.os }} - path: | - dist/*-portable.exe - dist/*.zip - dist/*.dmg - dist/*.deb - dist/*.rpm - dist/*.tar.gz - dist/*.yml - dist/*.blockmap - dist/*.pacman + # - name: Create artifact + # uses: actions/upload-artifact@v4 + # with: + # name: Build-${{ matrix.os }} + # path: | + # dist/*-portable.exe + # dist/*.zip + # dist/*.dmg + # dist/*.deb + # dist/*.rpm + # dist/*.tar.gz + # dist/*.yml + # dist/*.blockmap + # dist/*.pacman diff --git a/scripts/upload-build.cjs b/scripts/upload-build.cjs index 31421262..d7af3741 100644 --- a/scripts/upload-build.cjs +++ b/scripts/upload-build.cjs @@ -3,6 +3,11 @@ const { S3Client, PutObjectCommand } = require("@aws-sdk/client-s3"); const path = require("node:path"); const packageJson = require("../package.json"); +if (!process.env.BUILD_WEBHOOK_URL) { + console.log("No BUILD_WEBHOOK_URL provided, skipping upload"); + process.exit(0); +} + const s3 = new S3Client({ region: "auto", endpoint: process.env.S3_ENDPOINT, @@ -20,7 +25,7 @@ const extensionsToUpload = [".deb", ".exe", ".png"]; fs.readdir(dist, async (err, files) => { if (err) throw err; - const results = await Promise.all( + const uploads = await Promise.all( files.map(async (file) => { if (extensionsToUpload.includes(path.extname(file))) { const fileName = `${new Date().getTime()}-${file}`; @@ -47,9 +52,10 @@ fs.readdir(dist, async (err, files) => { "Content-Type": "application/json", }, body: JSON.stringify({ - results, + uploads, branchName: process.env.BRANCH_NAME, version: packageJson.version, + actor: process.env.GITHUB_ACTOR, }), }); });