Add image onerror handling for avatars #54
Workflow file for this run
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: "Publish" | |
on: | |
push: | |
tags: [ '*' ] | |
env: | |
CHROME_EXTENSION_ID: mkaledojmamkljdldoeefpabbgfdkack | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
name: "Create release" | |
outputs: | |
release_upload_url: ${{ steps.release.outputs.upload_url }} | |
steps: | |
- name: Create Release | |
id: release | |
uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag: ${{ github.ref }} | |
name: v${{ github.ref_name }} | |
draft: true | |
# ----------------------------------------------------------------------------------------------------------------------- | |
# Build | |
# | |
# Builds the extension in a matrix mode for Browser Chrome & Firefox and Manifest Version 2 & 3 | |
# - {ref_name}_chrome_mv2.zip | |
# - {ref_name}_chrome_mv3.zip | |
# - {ref_name}_firefox_mv2.zip | |
# - {ref_name}_firefox_mv3.zip | |
# ----------------------------------------------------------------------------------------------------------------------- | |
build: | |
runs-on: ubuntu-latest | |
name: "Build (${{ matrix.browser_target }} MV${{ matrix.manifest_version }})" | |
needs: [ release ] | |
strategy: | |
matrix: | |
manifest_version: [ 2, 3 ] | |
browser_target: [ "chrome", "firefox" ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Setup jq | |
run: sudo apt-get install -y jq | |
- name: Prepare env file | |
run: | | |
touch .env.local | |
echo "VITE_OAUTH_CLIENT_ID=01GNNDFDM0SP0FT0DJ942SSGQQ" >> .env.local | |
- name: Fill env file (production) | |
if: ${{ contains(github.ref_name, 'dev') == false }} | |
run: | | |
echo "MANIFEST_HOST_API=*://*.streamfinity.tv/*" >> .env.local | |
echo "MANIFEST_HOST_FRONTEND=*://*.streamfinity.tv/*" >> .env.local | |
echo "VITE_API_URL=https://cyber.streamfinity.tv" >> .env.local | |
echo "VITE_FRONTEND_URL=https://streamfinity.tv" >> .env.local | |
- name: Fill env file (development) | |
if: ${{ contains(github.ref_name, 'dev') == true }} | |
run: | | |
echo "MANIFEST_HOST_API=*://*.streamfinity.tv/*" >> .env.local | |
echo "MANIFEST_HOST_FRONTEND=*://*.streamfinity.tv/*" >> .env.local | |
echo "VITE_API_URL=https://development-backend.streamfinity.tv" >> .env.local | |
echo "VITE_FRONTEND_URL=https://development.streamfinity.tv" >> .env.local | |
- name: Install dependencies | |
run: npm install | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Update version | |
run: ./tag-version.sh ${{ github.ref_name }} | |
- name: Build extension | |
run: npm run build | |
env: | |
MANIFEST_VERSION: ${{ matrix.manifest_version }} | |
BROWSER_TARGET: ${{ matrix.browser_target }} | |
- name: Create archive | |
run: cd dist && zip -r ${{ github.ref_name }}_${{ matrix.browser_target }}_mv${{ matrix.manifest_version }}.zip . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ github.ref_name }}_${{ matrix.browser_target }}_mv${{ matrix.manifest_version }}.zip" | |
path: "dist/*.zip" | |
# ----------------------------------------------------------------------------------------------------------------------- | |
# Pack | |
# ----------------------------------------------------------------------------------------------------------------------- | |
# Create a .crx file for Chrome browsers | |
# - chrome_{ref_name}_mv2.crx | |
# - chrome_{ref_name}_mv3.crx | |
pack-chrome: | |
name: "Pack (chrome MV${{ matrix.manifest_version }})" | |
runs-on: ubuntu-latest | |
needs: [ release, build ] | |
strategy: | |
matrix: | |
manifest_version: [ 2, 3 ] | |
browser_target: [ "chrome" ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: "${{ github.ref_name }}_${{ matrix.browser_target }}_mv${{ matrix.manifest_version }}.zip" | |
path: artifacts/ | |
- run: ls -la artifacts | |
- uses: cardinalby/webext-buildtools-chrome-crx-action@v2 | |
with: | |
zipFilePath: "artifacts/${{ github.ref_name }}_${{ matrix.browser_target }}_mv${{ matrix.manifest_version }}.zip" | |
crxFilePath: "dist/chrome_${{ github.ref_name }}_mv${{ matrix.manifest_version }}.crx" | |
privateKey: ${{ secrets.CHROME_CRX_PRIVATE_KEY }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "chrome_${{ github.ref_name }}_mv${{ matrix.manifest_version }}.crx" | |
path: "dist/*.crx" | |
# Creates a .xpi file for Firefox browsers | |
# - firefox_{ref_name}_mv2.xpi | |
# - firefox_{ref_name}_mv3.xpi | |
pack-firefox: | |
name: "Pack (firefox MV${{ matrix.manifest_version }})" | |
runs-on: ubuntu-latest | |
needs: [ release, build ] | |
strategy: | |
matrix: | |
manifest_version: [ 2, 3 ] | |
browser_target: [ "firefox" ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: "${{ github.ref_name }}_${{ matrix.browser_target }}_mv${{ matrix.manifest_version }}.zip" | |
path: artifacts/ | |
- run: ls -la artifacts | |
- run: | | |
mkdir -p dist/ | |
mv artifacts/${{ github.ref_name }}_${{ matrix.browser_target }}_mv${{ matrix.manifest_version }}.zip dist/firefox_${{ github.ref_name }}_mv${{ matrix.manifest_version }}.xpi | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "firefox_${{ github.ref_name }}_mv${{ matrix.manifest_version }}.xpi" | |
path: "dist/*.xpi" | |
# ----------------------------------------------------------------------------------------------------------------------- | |
# Publish | |
# ----------------------------------------------------------------------------------------------------------------------- | |
publish-firefox: | |
name: "Publish Firefox (MV${{ matrix.manifest_version }})" | |
runs-on: ubuntu-latest | |
needs: [ pack-firefox ] | |
strategy: | |
matrix: | |
manifest_version: [ 2 ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: "firefox_${{ github.ref_name }}_mv${{ matrix.manifest_version }}.xpi" | |
path: artifacts/ | |
- run: | | |
tree artifacts/ | |
mkdir -p dist/ | |
- name: Sign extension | |
id: web-ext-sign | |
uses: kewisch/action-web-ext@v1 | |
with: | |
cmd: sign | |
source: "artifacts/firefox_${{ github.ref_name }}_mv${{ matrix.manifest_version }}.xpi" | |
artifacts: dist | |
channel: ${{ contains(github.ref_name, 'dev') == false && 'listed' || 'unlisted' }} | |
apiKey: ${{ secrets.FIREFOX_API_KEY }} | |
apiSecret: ${{ secrets.FIREFOX_API_SECRET }} | |
timeout: 900000 | |
- id: firefox-mv | |
if: ${{ steps.web-ext-sign.outputs.target }} | |
run: | | |
mv ${{ steps.web-ext-sign.outputs.target }} dist/firefox_${{ github.ref_name }}_mv${{ matrix.manifest_version }}_signed.xpi | |
echo "success=1" >> "$GITHUB_OUTPUT" | |
- uses: actions/upload-artifact@v4 | |
if: steps.firefox-mv.outputs.success | |
with: | |
name: "firefox_${{ github.ref_name }}_mv${{ matrix.manifest_version }}_signed.xpi" | |
path: "dist/*.xpi" | |
publish-chrome: | |
name: "Publish Chrome (MV${{ matrix.manifest_version }})" | |
runs-on: ubuntu-latest | |
needs: [ pack-chrome ] | |
strategy: | |
matrix: | |
manifest_version: [ 3 ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: "${{ github.ref_name }}_chrome_mv${{ matrix.manifest_version }}.zip" # <--- "chrome" hardcoded, uses .zip instead of .xpi | |
path: artifacts/ | |
- run: mkdir -p dist/ | |
- name: Upload to Chrome Web Store | |
uses: mobilefirstllc/cws-publish@latest | |
with: | |
action: ${{ contains(github.ref_name, 'dev') && 'testers' || 'upload' }} # can not publish to extension in review (one of: upload, publish, testers) | |
client_id: ${{ secrets.CHROME_CLIENT_ID }} | |
client_secret: ${{ secrets.CHROME_CLIENT_SECRET }} | |
refresh_token: ${{ secrets.CHROME_REFRESH_TOKEN }} | |
extension_id: ${{ env.CHROME_EXTENSION_ID }} | |
zip_file: "artifacts/${{ github.ref_name }}_chrome_mv${{ matrix.manifest_version }}.zip" | |
publish-edge: | |
name: "Publish Edge (MV${{ matrix.manifest_version }})" | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
strategy: | |
matrix: | |
manifest_version: [ 3 ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: "${{ github.ref_name }}_chrome_mv${{ matrix.manifest_version }}.zip" # <--- "chrome" hardcoded, uses .zip instead of .xpi | |
path: artifacts/ | |
- uses: wdzeng/edge-addon@v1 | |
with: | |
product-id: ${{ secrets.EDGE_PRODUCT_ID }} | |
zip-path: "artifacts/${{ github.ref_name }}_chrome_mv${{ matrix.manifest_version }}.zip" | |
upload-only: true # TODO change to "false" when approved | |
client-id: ${{ secrets.EDGE_CLIENT_ID }} | |
client-secret: ${{ secrets.EDGE_CLIENT_SECRET }} | |
access-token-url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }} | |
# ----------------------------------------------------------------------------------------------------------------------- | |
# Release | |
# ----------------------------------------------------------------------------------------------------------------------- | |
release-publish: | |
name: "Publish release" | |
runs-on: ubuntu-latest | |
needs: [ release, pack-chrome, pack-firefox, publish-firefox, publish-edge ] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
- run: tree artifacts/ | |
- run: mkdir dist | |
- run: find artifacts/ -type f -print0 | xargs -0 mv -t dist/ | |
- run: ls -lisah dist/ | |
- name: Upload Assets to Release | |
uses: csexton/release-asset-action@v2 | |
with: | |
pattern: "dist/*" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
release-url: ${{ needs.release.outputs.release_upload_url }} | |
- name: Publish Release | |
id: release | |
uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag: ${{ github.ref }} | |
name: v${{ github.ref_name }} | |
draft: false | |
prerelease: ${{ contains(github.ref_name, 'dev') == true }} | |
allowUpdates: true | |
- uses: sarisia/actions-status-discord@v1 | |
if: always() | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }} |