fix error if no secrets/credentials #1
No files matched your search
@@ -117,6 +117,26 @@ jobs:
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Check store credentials
|
||||
id: credentials
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import os
|
||||
stores = {
|
||||
'firefox': ('AMO_JWT_ISSUER', 'AMO_JWT_SECRET'),
|
||||
'chrome': ('CWS_PUBLISHER_ID', 'CWS_EXTENSION_ID', 'CWS_CLIENT_ID',
|
||||
'CWS_CLIENT_SECRET', 'CWS_REFRESH_TOKEN'),
|
||||
}
|
||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as output:
|
||||
for store, names in stores.items():
|
||||
missing = [name for name in names if not os.environ.get(name, '').strip()]
|
||||
output.write(f"{store}={'false' if missing else 'true'}\n")
|
||||
if missing:
|
||||
print(f"Skipping {store} deployment: missing credentials: {', '.join(missing)}")
|
||||
else:
|
||||
print(f"{store} deployment enabled")
|
||||
PY
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
@@ -129,6 +149,7 @@ jobs:
|
||||
path: dist/packages
|
||||
|
||||
- name: Set up Firefox signing tools
|
||||
if: steps.credentials.outputs.firefox == 'true'
|
||||
run: |
|
||||
npm install --global web-ext
|
||||
python - <<'PY'
|
||||
@@ -151,6 +172,7 @@ jobs:
|
||||
PY
|
||||
|
||||
- name: Sign and submit Firefox package to AMO
|
||||
if: steps.credentials.outputs.firefox == 'true'
|
||||
run: |
|
||||
test -n "$AMO_JWT_ISSUER" || { echo 'Missing AMO_JWT_ISSUER secret'; exit 1; }
|
||||
test -n "$AMO_JWT_SECRET" || { echo 'Missing AMO_JWT_SECRET secret'; exit 1; }
|
||||
@@ -167,6 +189,7 @@ jobs:
|
||||
cp "$firefox_xpi" dist/packages/proxyswitcherforkbywt-firefox-signed.xpi
|
||||
|
||||
- name: Upload Chrome package to Chrome Web Store
|
||||
if: steps.credentials.outputs.chrome == 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for name in CWS_PUBLISHER_ID CWS_EXTENSION_ID CWS_CLIENT_ID CWS_CLIENT_SECRET CWS_REFRESH_TOKEN; do
|
||||
@@ -191,20 +214,31 @@ jobs:
|
||||
-H "Authorization: Bearer $token" \
|
||||
"https://chromewebstore.googleapis.com/v2/publishers/$CWS_PUBLISHER_ID/items/$CWS_EXTENSION_ID:publish"
|
||||
|
||||
- name: Attach signed Firefox and Chrome packages to release
|
||||
- name: Prepare release assets
|
||||
run: |
|
||||
mkdir -p dist/release-assets
|
||||
chrome_zip=$(find dist/packages -name 'proxyswitcherforkbywt-chrome.zip' -print -quit)
|
||||
test -f "$chrome_zip"
|
||||
cp "$chrome_zip" dist/release-assets/
|
||||
firefox_xpi=dist/packages/proxyswitcherforkbywt-firefox-signed.xpi
|
||||
if [ ! -f "$firefox_xpi" ]; then
|
||||
firefox_xpi=$(find dist/packages -name 'proxyswitcherforkbywt-firefox.xpi' -print -quit)
|
||||
fi
|
||||
test -f "$firefox_xpi"
|
||||
cp "$firefox_xpi" dist/release-assets/
|
||||
|
||||
- name: Attach Firefox and Chrome packages to release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: |
|
||||
gh release upload "${{ github.event.release.tag_name }}" \
|
||||
dist/packages/proxyswitcherforkbywt-firefox-signed.xpi \
|
||||
"$chrome_zip" \
|
||||
gh release upload "$RELEASE_TAG" \
|
||||
dist/release-assets/* \
|
||||
--clobber
|
||||
|
||||
- name: Upload signed packages as workflow artifacts
|
||||
- name: Upload release packages as workflow artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: signed-extension-packages-${{ github.event.release.tag_name }}
|
||||
name: release-extension-packages-${{ github.event.release.tag_name }}
|
||||
if-no-files-found: error
|
||||
path: |
|
||||
dist/packages/proxyswitcherforkbywt-firefox-signed.xpi
|
||||
dist/packages/**/proxyswitcherforkbywt-chrome.zip
|
||||
path: dist/release-assets/*
|
||||
@@ -30,6 +30,7 @@ This repository contains the Firefox WebExtension **Proxy Switcher Fork By WT**.
|
||||
- Never hand-edit or retain stale `META-INF` signatures after changing files. Build artifacts must be signed again before distribution.
|
||||
- Do not commit generated `web-ext-artifacts/` packages unless explicitly requested.
|
||||
- Keep publishing credentials only in GitHub Secrets. The release workflow expects AMO JWT credentials and Chrome Web Store OAuth credentials.
|
||||
- Missing or incomplete store credentials must skip only that store's deployment. Keep package builds, release assets, and workflow artifacts available without store credentials.
|
||||
|
||||
## Validation
|
||||
|
||||
|
||||
@@ -104,6 +104,8 @@ Configure these repository or environment secrets before publishing:
|
||||
- `CWS_PUBLISHER_ID` and `CWS_EXTENSION_ID` — Chrome Web Store publisher and existing item IDs.
|
||||
- `CWS_CLIENT_ID`, `CWS_CLIENT_SECRET`, and `CWS_REFRESH_TOKEN` — Google OAuth credentials with Chrome Web Store API access.
|
||||
|
||||
Each store is optional: deployment runs only when its full set of credentials is present. Missing or incomplete credentials skip that store without failing the workflow or skipping the other store. Both packages are still built and attached to the release. If Firefox deployment is skipped, the release contains the unsigned Firefox XPI for development instead of a signed XPI. Invalid credentials or actual store API failures still fail the deployment step.
|
||||
|
||||
The stores must already contain their initial listings and required privacy information. Store review still applies; the workflow submits the update and does not bypass review. Never commit any of these credentials.
|
||||
|
||||
To remove generated packages:
|
||||
|
||||
Reference in new issue
Block a user