fix error if no secrets/credentials
This commit is contained in:
1 parent
07a0f2c1e3
commit
319bcdefbd
3 files changed
+46
-9
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/*
|
||||
Reference in new issue
Block a user