Margin is an open annotation layer for the internet. Powered by the AT Protocol.
margin.at
extension
web
atproto
comments
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 # uses: nicholaslee119/edge-addon-upload@master
60 # with:
61 # product_id: ${{ secrets.EDGE_PRODUCT_ID }}
62 # client_id: ${{ secrets.EDGE_CLIENT_ID }}
63 # client_secret: ${{ secrets.EDGE_CLIENT_SECRET }}
64 # access_token_url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }}
65 # file_path: margin-extension-chrome.zip
66
67 - name: Publish to Firefox AMO
68 continue-on-error: true
69 env:
70 AMO_JWT_ISSUER: ${{ secrets.AMO_JWT_ISSUER }}
71 AMO_JWT_SECRET: ${{ secrets.AMO_JWT_SECRET }}
72 run: |
73 cd extension
74 COMMIT_MSG=$(git log -1 --pretty=%s)
75 echo "{\"release_notes\": {\"en-US\": \"$COMMIT_MSG\"}, \"notes\": \"Thank you!\"}" > amo-metadata.json
76 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..."
77 rm amo-metadata.json
78 cd ..
79
80 - name: Create Release
81 uses: softprops/action-gh-release@v1
82 with:
83 files: |
84 margin-extension-chrome.zip
85 margin-extension-firefox.xpi
86 generate_release_notes: true
87 draft: false
88 prerelease: false