fix(ab): average seedtime #553
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Action Release | |
on: | |
push: | |
branches: [ dev ] | |
pull_request: | |
branches: [ dev ] | |
workflow_call: | |
inputs: | |
ref: | |
default: 'dev' | |
type: string | |
auto_update_file: | |
default: 'canary.xml' | |
type: string | |
build_xpi: | |
default: false | |
type: boolean | |
outputs: | |
version: | |
value: ${{ jobs.zip.outputs.version }} | |
buildXPI: | |
value: ${{ jobs.xpi.outputs.exist_xpi_file }} | |
secrets: | |
CRX_PRIVATE_KEY: | |
required: true | |
jobs: | |
build: | |
name: Build dist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
ref: ${{ inputs.ref }} | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Get yarn cache | |
id: yarn-cache | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: yarn build | |
continue-on-error: true | |
- name: Upload Built to action | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-dist-folder | |
path: dist | |
zip: | |
name: Build Zip | |
runs-on: ubuntu-latest | |
needs: build | |
outputs: | |
version: ${{ steps.zip.outputs.extensionVersion }} | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-dist-folder | |
path: dist | |
- id: zip | |
name: Build Zip | |
uses: cardinalby/webext-buildtools-pack-extension-dir-action@v1 | |
with: | |
extensionDir: 'dist' | |
zipFilePath: 'artifact/extension.zip' | |
- name: Upload Built Zip to action | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dev-build-${{ steps.zip.outputs.extensionVersion }}-zip | |
path: artifact/* | |
crx: | |
name: Build Crx (Chromium) | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Set name output | |
id: auto_update_file | |
env: | |
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }} | |
if: ${{ env.CRX_PRIVATE_KEY != '' }} | |
run: | | |
USER_INPUT=${{ inputs.auto_update_file }} | |
echo "value=${USER_INPUT:-"stable.xml"}" >> $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v3 | |
env: | |
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }} | |
if: ${{ env.CRX_PRIVATE_KEY != '' }} | |
with: | |
name: build-dist-folder | |
path: dist | |
- name: Add update_url | |
env: | |
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }} | |
if: ${{ env.CRX_PRIVATE_KEY != '' }} | |
run: echo $(jq '. |= .+ {"update_url":"https://pt-plugins.github.io/PT-Plugin-Plus/update/${{ steps.auto_update_file.outputs.value }}"}' dist/manifest.json) > dist/manifest.json | |
- id: zip | |
name: Build Zip With update_url | |
uses: cardinalby/webext-buildtools-pack-extension-dir-action@v1 | |
env: | |
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }} | |
if: ${{ env.CRX_PRIVATE_KEY != '' }} | |
with: | |
extensionDir: 'dist' | |
zipFilePath: 'extension.zip' | |
- name: Build Crx | |
env: | |
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }} | |
if: ${{ env.CRX_PRIVATE_KEY != '' }} | |
uses: cardinalby/webext-buildtools-chrome-crx-action@v2 | |
with: | |
zipFilePath: 'extension.zip' | |
crxFilePath: 'artifact/extension.crx' | |
privateKey: ${{ secrets.CRX_PRIVATE_KEY }} | |
updateXmlPath: artifact/${{ steps.auto_update_file.outputs.value }} | |
updateXmlCodebaseUrl: https://github.com/pt-plugins/PT-Plugin-Plus/releases/download/v${{ steps.zip.outputs.extensionVersion }}/PT-Plugin-Plus-${{ steps.zip.outputs.extensionVersion }}.crx | |
- name: Upload Built Crx to action | |
env: | |
CRX_PRIVATE_KEY: ${{ secrets.CRX_PRIVATE_KEY }} | |
if: ${{ env.CRX_PRIVATE_KEY != '' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dev-build-${{ steps.zip.outputs.extensionVersion }}-crx | |
path: artifact/* | |
xpi: | |
name: Build Xpi (Firefox) | |
runs-on: ubuntu-latest | |
needs: zip | |
if: ${{ inputs.build_xpi }} | |
outputs: | |
exist_xpi_file: ${{ steps.addonsDeploy.outcome }} | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dev-build-${{ needs.zip.outputs.version }}-zip | |
- uses: cardinalby/webext-buildtools-firefox-sign-xpi-action@v1 | |
id: addonsDeploy | |
if: ${{ env.FF_EXT_UUID != '' }} | |
env: | |
FF_EXT_UUID: ${{ secrets.FF_EXT_UUID }} | |
continue-on-error: true | |
with: | |
timeoutMs: 600000 | |
zipFilePath: extension.zip | |
xpiFilePath: artifact/extension.signed.xpi | |
extensionId: ${{ secrets.FF_EXT_UUID }} | |
jwtIssuer: ${{ secrets.FF_JWT_ISSUER }} | |
jwtSecret: ${{ secrets.FF_JWT_SECRET }} | |
- name: Upload Built Xpi to action | |
uses: actions/upload-artifact@v3 | |
if: ${{ steps.addonsDeploy.outcome == 'success' }} | |
with: | |
name: dev-build-${{ needs.zip.outputs.version }}-xpi | |
path: artifact/* |