aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/publish.yml
diff options
context:
space:
mode:
authorVen <vendicated@riseup.net>2023-01-26 22:38:02 +0100
committerGitHub <noreply@github.com>2023-01-26 22:38:02 +0100
commit399305fd8a51de8f0e14d1898d9dd904c540f062 (patch)
treed3b34626c19d7af6549040648e340f1a041d30a2 /.github/workflows/publish.yml
parent0c030a3a27e4c34409143261975fb3bd0e481fcb (diff)
downloadVencord-399305fd8a51de8f0e14d1898d9dd904c540f062.tar.gz
Vencord-399305fd8a51de8f0e14d1898d9dd904c540f062.tar.bz2
Vencord-399305fd8a51de8f0e14d1898d9dd904c540f062.zip
Automatic extension publishing (#453)
Diffstat (limited to '.github/workflows/publish.yml')
-rw-r--r--.github/workflows/publish.yml60
1 files changed, 60 insertions, 0 deletions
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..34738b9
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,60 @@
+name: Release Browser Extension
+on:
+ push:
+ tags:
+ - v*
+
+jobs:
+ Publish:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: check that tag matches package.json version
+ run: |
+ pkg_version="$(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
+
+ - 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: |
+ cd dist/extension-unpacked
+
+ # 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
+
+ # Chrome
+ pnpx chrome-webstore-upload-cli@2.1.0 upload --auto-publish || EXIT_CODE=$?
+
+ # Firefox
+ pnpx web-ext-submit@7.4.0
+
+ exit $EXIT_CODE
+ env:
+ # 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 }}
+