Firefox WebExtension (Desktop and Mobile) that lets you share the current tab to Margit.at, frontpage.fyi, etc. with minimal effort.
at tangled 100 lines 3.2 kB view raw
1name: package-extension 2 3on: 4 workflow_dispatch: 5 6jobs: 7 build: 8 name: Build unsigned bundle 9 runs-on: ubuntu-latest 10 environment: "Default" 11 permissions: 12 contents: write 13 env: 14 AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }} 15 AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }} 16 17 steps: 18 - name: Checkout repository 19 uses: actions/checkout@v4 20 21 - name: Setup Node.js 22 uses: actions/setup-node@v4 23 with: 24 node-version: "20" 25 26 - name: Install web-ext 27 run: npm install --global web-ext 28 29 - name: Build unsigned archive 30 run: web-ext build --source-dir ./extension --artifacts-dir ./web-ext-artifacts 31 32 - name: Determine version 33 run: | 34 VERSION=$(node -pe "require('./extension/manifest.json').version") 35 echo "VERSION=${VERSION}" >> $GITHUB_ENV 36 echo "TAG=v${VERSION}-${GITHUB_RUN_ID}" >> $GITHUB_ENV 37 38 - name: Rename unsigned archive 39 run: | 40 ZIP_PATH=$(ls web-ext-artifacts/*.zip) 41 mv "$ZIP_PATH" "web-ext-artifacts/frontpage-submitter-${VERSION}.zip" 42 43 - name: Upload unsigned artifact 44 uses: actions/upload-artifact@v4 45 with: 46 name: frontpage-extension-unsigned 47 path: web-ext-artifacts/frontpage-submitter-${{ env.VERSION }}.zip 48 49 - name: Sign using AMO (optional) 50 env: 51 WEB_EXT_API_KEY: ${{ env.AMO_JWT_ISSUER }} 52 WEB_EXT_API_SECRET: ${{ env.AMO_JWT_SECRET }} 53 WEB_EXT_ID: frontpage-submitter@example.com 54 run: | 55 if [ -z "${WEB_EXT_API_KEY}" ] || [ -z "${WEB_EXT_API_SECRET}" ]; then 56 echo "AMO credentials not provided. Skipping signing step." 57 exit 0 58 fi 59 set +e 60 web-ext sign \ 61 --channel=unlisted \ 62 --source-dir ./extension \ 63 --artifacts-dir ./web-ext-artifacts 2>&1 | tee ./sign.log 64 rc=${PIPESTATUS[0]} 65 set -e 66 if [ $rc -ne 0 ]; then 67 if grep -q "Version ${VERSION} already exists" ./sign.log; then 68 echo "AMO already has version ${VERSION}; skipping signing." 69 exit 0 70 fi 71 echo "Signing failed:" 72 cat ./sign.log 73 exit $rc 74 fi 75 76 - name: Rename signed archive (optional) 77 if: ${{ hashFiles('web-ext-artifacts/*.xpi') != '' }} 78 run: | 79 XPI_PATH=$(ls web-ext-artifacts/*.xpi) 80 mv "$XPI_PATH" "web-ext-artifacts/frontpage-submitter-${VERSION}.xpi" 81 82 - name: Upload signed artifact (optional) 83 if: ${{ hashFiles('web-ext-artifacts/*.xpi') != '' }} 84 uses: actions/upload-artifact@v4 85 with: 86 name: frontpage-extension-signed 87 path: web-ext-artifacts/*.xpi 88 89 - name: Create GitHub release 90 uses: softprops/action-gh-release@v2 91 with: 92 tag_name: ${{ env.TAG }} 93 name: Frontpage Submitter ${{ env.VERSION }} (build ${{ github.run_number }}) 94 draft: false 95 prerelease: true 96 generate_release_notes: false 97 files: | 98 web-ext-artifacts/*.zip 99 web-ext-artifacts/*.xpi 100 fail_on_unmatched_files: false