diff --git a/.eslintrc.js b/.eslintrc.js index 79fcc7c3..16739f9f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -106,22 +106,6 @@ module.exports = { "prefer-const": "error", }, }, - { - files: ["utils/*.js", "utils/*.cjs", "utils/*.mjs"], - env: { - node: true, - browser: false, - }, - parserOptions: { - ecmaVersion: 2023, - sourceType: "module", - }, - rules: { - "no-var": "error", - "prefer-const": "error", - strict: "off" - }, - }, ], parserOptions: { diff --git a/.github/workflows/bitbucket.yml b/.github/workflows/bitbucket.yml index 326094e3..f609b96e 100644 --- a/.github/workflows/bitbucket.yml +++ b/.github/workflows/bitbucket.yml @@ -4,8 +4,6 @@ on: push: branches: [ wip/build-xpi ] - workflow_dispatch: - env: XPI_NAME: tabmix-dev-build @@ -40,87 +38,16 @@ jobs: version=$(next_version) date=$(date +'%Y%m%d.%H%M') sed -i "s/1.0.0-unbundeled/$version-$date/" addon/install.rdf + echo "next version: $version-$date" - name: Zip addon folder run: | cd addon zip -rq /tmp/${{ env.XPI_NAME }}.xpi * - # - name: Upload XPI to artifact - # uses: actions/upload-artifact@v4 - # with: - # name: ${{ env.XPI_NAME }} - # path: ${{ env.XPI_NAME }}.xpi - - # - name: Download XPI from artifact - # uses: actions/download-artifact@v4 - # with: - # name: ${{ env.XPI_NAME }} - - # - name: Use Node.js - # uses: actions/setup-node@v4 - # with: - # node-version: '20' - - # - name: Install dependencies - # run: | - # npm install node-fetch form-data - - # - name: Upload dev-build to bitbucket - # env: - # BITBUCKET_ACCESS_TOKEN: ${{ secrets.BITBUCKET_ACCESS_TOKEN }} - # run: node ./utils/bitbucket.mjs - - name: Upload dev-build to bitbucket run: | curl --request POST \ --url 'https://api.bitbucket.org/2.0/repositories/onemen/tabmixplus-for-firefox/downloads' \ --header 'Authorization: Bearer ${{ secrets.BITBUCKET_ACCESS_TOKEN }}' \ -F 'files=@/tmp/${{ env.XPI_NAME }}.xpi' - - - # - name: Upload dev-build to bitbucket - # uses: actions/github-script@v7 - # with: - # script: | - # try { - # const fs = require('fs'); - # const FormData = require('form-data'); - - # const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); - - # const formData = new FormData() - # const filePath = '${{ env.XPI_NAME }}.xpi' - # console.log({filePath}) - # const readStream = fs.createReadStream(filePath) - # console.log({readStream}) - # formData.append("files", readStream) - # console.log({formData}) - - # const BITBUCKET_URL = - # 'https://api.bitbucket.org/2.0/repositories/onemen/tabmixplus-for-firefox/downloads' - # console.log({BITBUCKET_URL}) - - # let boundary = '--------------------------' - # for (var i = 0; i < 24; i++) { - # boundary += Math.floor(Math.random() * 10).toString(16) - # } - # console.log({boundary}) - - # const headers = new Headers({ - # Authorization: `Bearer ${{ secrets.BITBUCKET_ACCESS_TOKEN }}`, - # "Content-Type": `multipart/form-data; boundary=${boundary}`, - # }) - # console.log({headers}) - - # const response = await fetch(BITBUCKET_URL, {method: "POST", body: formData, headers}) - # console.log({response}) - # if (response.ok) { - # console.log(`File ${basename(filePath)} was uploaded to bitbucket downloads page`) - # } else { - # const text = await response.text() - # console.log("Error uploading file:", text, response.status, response.statusText) - # } - # } catch (error) { - # console.log(error) - # } diff --git a/utils/bitbucket.mjs b/utils/bitbucket.mjs deleted file mode 100644 index d6095309..00000000 --- a/utils/bitbucket.mjs +++ /dev/null @@ -1,29 +0,0 @@ -import FormData from "form-data"; -import fs from "fs"; -import fetch from "node-fetch"; - -const BITBUCKET_URL = - 'https://api.bitbucket.org/2.0/repositories/onemen/tabmixplus-for-firefox/downloads'; - -async function bitbucketUpload() { - const formData = new FormData(); - const filePath = `/tmp/${process.env.XPI_NAME}.xpi`; - const readStream = fs.createReadStream(filePath); - formData.append("files", readStream); - - const headers = new Headers({ - Authorization: `Bearer ${process.env.BITBUCKET_ACCESS_TOKEN}`, - "Content-Type": `multipart/form-data; boundary=${formData.getBoundary()}`, - }); - - const response = await fetch(BITBUCKET_URL, {method: "POST", body: formData, headers}); - console.log({response}); - if (response.ok) { - console.log(`File ${filePath} was uploaded to bitbucket downloads page`); - } else { - const text = await response.text(); - console.log("Error uploading file:", text, response.status, response.statusText); - } -} - -bitbucketUpload();