Write on the margins of the internet. Powered by the AT Protocol. margin.at
extension web atproto comments
at ui-refactor 111 lines 4.0 kB view raw
1name: Release Extension 2 3on: 4 push: 5 tags: 6 - "v*" 7 8jobs: 9 release: 10 runs-on: ubuntu-latest 11 permissions: 12 contents: write 13 14 steps: 15 - name: Checkout code 16 uses: actions/checkout@v4 17 18 - name: Update Manifest Version 19 run: | 20 VERSION=${GITHUB_REF_NAME#v} 21 echo "Updating manifests to version $VERSION" 22 23 cd extension 24 for manifest in manifest.json manifest.chrome.json manifest.firefox.json; do 25 if [ -f "$manifest" ]; then 26 tmp=$(mktemp) 27 jq --arg v "$VERSION" '.version = $v' "$manifest" > "$tmp" && mv "$tmp" "$manifest" 28 echo "Updated $manifest" 29 fi 30 done 31 cd .. 32 33 - name: Build Extension (Chrome) 34 run: | 35 cd extension 36 cp manifest.chrome.json manifest.json 37 zip -r ../margin-extension-chrome.zip . -x "*.DS_Store" -x "*.git*" -x "manifest.*.json" 38 cd .. 39 40 - name: Build Extension (Firefox) 41 run: | 42 cd extension 43 cp manifest.firefox.json manifest.json 44 zip -r ../margin-extension-firefox.xpi . -x "*.DS_Store" -x "*.git*" -x "manifest.*.json" 45 cd .. 46 47 - name: Publish to Chrome Web Store 48 continue-on-error: true 49 uses: mobilefirstllc/cws-publish@latest 50 with: 51 action: publish 52 client_id: ${{ secrets.CHROME_CLIENT_ID }} 53 client_secret: ${{ secrets.CHROME_CLIENT_SECRET }} 54 refresh_token: ${{ secrets.CHROME_REFRESH_TOKEN }} 55 extension_id: ${{ secrets.CHROME_EXTENSION_ID }} 56 zip_file: margin-extension-chrome.zip 57 58 - name: Publish to Edge Add-ons 59 continue-on-error: true 60 run: | 61 echo "Uploading package to Edge Add-ons..." 62 curl \ 63 -H "Authorization: ApiKey ${{ secrets.EDGE_API_KEY }}" \ 64 -H "X-ClientID: ${{ secrets.EDGE_CLIENT_ID }}" \ 65 -H "Content-Type: application/zip" \ 66 -X POST \ 67 -T margin-extension-chrome.zip \ 68 -f -sS \ 69 https://api.addons.microsoftedge.microsoft.com/v1/products/${{ secrets.EDGE_PRODUCT_ID }}/submissions/draft/package 70 71 echo "Publishing submission..." 72 curl \ 73 -H "Authorization: ApiKey ${{ secrets.EDGE_API_KEY }}" \ 74 -H "X-ClientID: ${{ secrets.EDGE_CLIENT_ID }}" \ 75 -X POST \ 76 -d '{ "notes": "New release" }' \ 77 -f -sS \ 78 https://api.addons.microsoftedge.microsoft.com/v1/products/${{ secrets.EDGE_PRODUCT_ID }}/submissions 79 80 - name: Publish to Firefox AMO 81 continue-on-error: true 82 env: 83 AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }} 84 AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }} 85 run: | 86 cd extension 87 COMMIT_MSG=$(git log -1 --pretty=%s) 88 echo "{\"release_notes\": {\"en-US\": \"$COMMIT_MSG\"}, \"notes\": \"Thank you!\"}" > amo-metadata.json 89 npx web-ext sign --channel=listed --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET --source-dir=. --artifacts-dir=../web-ext-artifacts --approval-timeout=300000 --amo-metadata=amo-metadata.json || echo "Web-ext sign timed out (expected), continuing..." 90 rm amo-metadata.json 91 cd .. 92 93 - name: Prepare signed Firefox XPI 94 run: | 95 if ls web-ext-artifacts/*.xpi 1> /dev/null 2>&1; then 96 SIGNED_XPI=$(ls web-ext-artifacts/*.xpi | head -1) 97 echo "Found signed XPI: $SIGNED_XPI" 98 cp "$SIGNED_XPI" margin-extension-firefox.xpi 99 else 100 echo "No signed XPI found, using unsigned build" 101 fi 102 103 - name: Create Release 104 uses: softprops/action-gh-release@v1 105 with: 106 files: | 107 margin-extension-chrome.zip 108 margin-extension-firefox.xpi 109 generate_release_notes: true 110 draft: false 111 prerelease: false