diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml new file mode 100644 index 00000000..6dde69f6 --- /dev/null +++ b/.github/actions/setup/action.yaml @@ -0,0 +1,23 @@ +name: Setup +runs: + using: composite + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org + cache: yarn + + - uses: actions/cache@v3 + id: install-cache + with: + path: node_modules/ + key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }} + + - if: steps.install-cache.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile --ignore-scripts + shell: bash + + - uses: gradle/gradle-build-action@v2 diff --git a/.github/workflows/auto_build.yaml b/.github/workflows/auto_build.yaml new file mode 100644 index 00000000..55024d06 --- /dev/null +++ b/.github/workflows/auto_build.yaml @@ -0,0 +1,64 @@ +name: Create Release + +on: + push: + tags: + - v* + pull_request: + tags: + - v* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v2 + - uses: ./.github/actions/setup + + - name: Build Chrome + run: | + yarn build:chrome + yarn build:chrome:mv3 + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Get Version Name + uses: actions/github-script@v3 + id: get-version + with: + script: | + const str=process.env.GITHUB_REF; + return str.substring(str.indexOf("v")); + result-encoding: string + + - name: Upload Asset + id: upload-asset1 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/unisat-chrome-mv2-${{steps.get-version.outputs.result}}.zip + asset_name: unisat-chrome-mv2-${{steps.get-version.outputs.result}}.zip + asset_content_type: application/zip + + - name: Upload Asset + id: upload-asset2 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/unisat-chrome-mv3-${{steps.get-version.outputs.result}}.zip + asset_name: unisat-chrome-mv3-${{steps.get-version.outputs.result}}.zip + asset_content_type: application/zip diff --git a/gulpfile.js b/gulpfile.js index abafa9bb..e520e7df 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,7 +16,7 @@ var knownOptions = { env: 'dev', browser: 'chrome', manifest: 'mv3', - channel: 'chrome' + channel: 'store' } }; diff --git a/package.json b/package.json index 520b638e..00474296 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "build:firefox": "gulp build --env=pro --browser=firefox --manifest=mv2 --channel=github", "build:brave": "gulp build --env=pro --browser=brave --manifest=mv2 --channel=github", "build:edge": "gulp build --env=pro --browser=edge --manifest=mv2 --channel=github", - "build:chrome:mv3": "gulp build --env=pro --browser=chrome --manifest=mv3 --channel=chrome", + "build:chrome:mv3:dev": "webpack --progress --env browser=chrome manifest=mv3 config=dev channel=github version=0.0.0", + "build:chrome:mv3": "gulp build --env=pro --browser=chrome --manifest=mv3 --channel=store", "translate": "node build/pull_translation", "lint": "eslint src --fix --ext .js,.ts,.tsx,.json && npm run format", "lint:fix": "eslint --fix src/**/*.{js,jsx,ts,tsx,json}",