Skip to content

Upload and Publish Beta Listing #36

Upload and Publish Beta Listing

Upload and Publish Beta Listing #36

Workflow file for this run

name: Upload and Publish Beta Listing
on:
workflow_dispatch:
inputs:
# This is the version that will trigger the workflow
version:
description: "Version to publish. For example, '1.0.0' or '2.0.0-beta.1'"
required: true
skip_tests:
description: "Skip the end-to-end tests"
required: true
default: false
env:
# Creates and uploads sourcemaps to Application error telemetry, and save the built extension as an artifact
PUBLIC_RELEASE: true
CHROME_MANIFEST_KEY: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs9/BXaFQsYPDxqbVvi11xhWdxfygfrF5YCLiboJooQyTkqIGpGxtI3JF/hkAXDcoqI+N5ATsGPYW34CdOc7uBCU91Ig+gHFiicnkzJaoOBjIwqx452l2/mp7cqNdavtCq40YENkF13ouj5loPwMMYY0L/sSvab+6eO20i1+Ulbsn9onS/fDd16clOaIbUVJ1PhyYvrU0HGVUqW5wUIDLyRezr3aTQLtDIQp/7DTBQ60S2G5KPpAW1UEphnXRLwl6cR5MiYw20OStfTZaA2qpWQvLAQtBoPNjP0Ld6rzI/e3uaC5qUMMCusitKeCA5HOFQDz2IJ0kS8Cn5fxzhXFi6QIDAQAB
MV: 3
RELEASE_CHANNEL: beta
DATADOG_APPLICATION_ID: ${{ secrets.DATADOG_APPLICATION_ID }}
DATADOG_CLIENT_TOKEN: ${{ secrets.DATADOG_CLIENT_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
env:
SOURCE_MAP_URL_BASE: https://pixiebrix-extension-source-maps.s3.amazonaws.com
SOURCE_MAP_PATH: sourcemaps/${{ github.job }}/${{ github.sha }}/mv3
# Docs https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
strategy:
fail-fast: false
name: build-beta
steps:
- uses: actions/checkout@v4
with:
ref: release/${{ github.event.inputs.version }}
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm
- run: npm ci
- run: npm run build
- run: bash scripts/upload-sourcemaps.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SOURCEMAP_USER_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SOURCEMAP_USER_KEY }}
AWS_DEFAULT_REGION: "us-east-2"
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
- name: Delete local sourcemaps
run: find dist -name '*.map' -delete
- name: Save store extension
uses: actions/upload-artifact@v4
with:
name: build-for-store-beta
path: dist
retention-days: 30
if-no-files-found: error
- name: Create production version
run: npx [email protected] dist/manifest.json key '${{ env.CHROME_MANIFEST_KEY }}'
- name: Save production extension
uses: actions/upload-artifact@v4
with:
name: build-production-beta
path: dist
retention-days: 30
if-no-files-found: error
end-to-end-tests:
name: end-to-end-tests
uses: ./.github/workflows/end-to-end-tests.yml
secrets: inherit
with:
checkout-ref: release/${{ github.event.inputs.version }}
if: ${{ github.event.inputs.skip_tests != 'true' }}
publish:
# https://github.com/fregante/chrome-webstore-upload-keys
needs:
- build
- end-to-end-tests
# https://stackoverflow.com/a/69354134
if: |
always() &&
needs.build.result == 'success' &&
(needs.end-to-end-tests.result == 'success' || needs.end-to-end-tests.result == 'skipped')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: build-for-store-beta
- name: Upload to Chrome Web Store (automatically publishes)
run: npx chrome-webstore-upload-cli@3 upload --auto-publish
env:
EXTENSION_ID: mpapkmgkphbggmlekkfnoilmafnbfile
CLIENT_ID: ${{ secrets.WEBSTORE_UPLOAD_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.WEBSTORE_UPLOAD_CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.WEBSTORE_UPLOAD_REFRESH_TOKEN }}
notify:
needs: build
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: release-notifications
SLACK_MESSAGE: "Chrome beta publish succeeded :rocket:"