2023-01-26 22:38:02 +01:00
|
|
|
name: Release Browser Extension
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Publish:
|
2023-06-09 19:48:18 +00:00
|
|
|
if: github.repository == 'Vendicated/Vencord'
|
2023-01-26 22:38:02 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: check that tag matches package.json version
|
|
|
|
run: |
|
2023-06-01 22:49:15 +02:00
|
|
|
pkg_version="v$(jq -r .version < package.json)"
|
|
|
|
if [[ "${{ github.ref_name }}" != "$pkg_version" ]]; then
|
|
|
|
echo "Tag ${{ github.ref_name }} does not match package.json version $pkg_version" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-01-26 22:38:02 +01:00
|
|
|
|
|
|
|
- uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
|
|
|
|
|
|
|
|
- name: Use Node.js 19
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 19
|
|
|
|
cache: "pnpm"
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Build web
|
|
|
|
run: pnpm buildWeb --standalone
|
|
|
|
|
|
|
|
- name: Publish extension
|
|
|
|
run: |
|
2023-06-01 22:49:15 +02:00
|
|
|
# Do not fail so that even if chrome fails, firefox gets a shot. But also store exit code to fail workflow later
|
|
|
|
EXIT_CODE=0
|
2023-01-26 22:38:02 +01:00
|
|
|
|
2023-06-01 22:49:15 +02:00
|
|
|
# Chrome
|
|
|
|
cd dist/chromium-unpacked
|
|
|
|
pnpx chrome-webstore-upload-cli@2.1.0 upload --auto-publish || EXIT_CODE=$?
|
2023-01-26 22:38:02 +01:00
|
|
|
|
2023-06-01 22:49:15 +02:00
|
|
|
# Firefox
|
|
|
|
cd ../firefox-unpacked
|
|
|
|
npm i -g web-ext@7.4.0 web-ext-submit@7.4.0
|
|
|
|
web-ext-submit || EXIT_CODE=$?
|
2023-01-26 22:38:02 +01:00
|
|
|
|
2023-06-01 22:49:15 +02:00
|
|
|
exit $EXIT_CODE
|
2023-01-26 22:38:02 +01:00
|
|
|
env:
|
2023-06-01 22:49:15 +02:00
|
|
|
# Chrome
|
|
|
|
EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
|
|
|
|
CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
|
|
|
|
CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
|
|
|
|
REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
|
|
|
|
|
|
|
|
# Firefox
|
|
|
|
WEB_EXT_API_KEY: ${{ secrets.WEBEXT_USER }}
|
|
|
|
WEB_EXT_API_SECRET: ${{ secrets.WEBEXT_SECRET }}
|