-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (78 loc) · 2.85 KB
/
firefox-addon.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Build, Sign, and Release Firefox Extension
name: Build, Sign, and Release Firefox Extension
on:
push:
branches:
- main
permissions:
contents: write
jobs:
check-manifest:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if manifest.json has changed
id: check-manifest
run: |
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD)
if ! echo "$CHANGED_FILES" | grep -q "manifest.json"; then
echo "manifest.json has not changed"
echo "manifest_changed=false" >> $GITHUB_OUTPUT
else
echo "manifest.json has changed"
echo "manifest_changed=true" >> $GITHUB_OUTPUT
fi
outputs:
manifest_changed: ${{ steps.check-manifest.outputs.manifest_changed }}
build-and-release:
needs: check-manifest
if: ${{ needs.check-manifest.outputs.manifest_changed == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install web-ext
run: npm install --global web-ext
- name: Build and sign the extension
run: web-ext sign --artifacts-dir ./artifacts --api-key ${{ secrets.AMO_JWT_ISSUER }} --api-secret ${{ secrets.AMO_JWT_SECRET }}
env:
WEB_EXT_API_KEY: ${{ secrets.JWT_ISSUER }}
WEB_EXT_API_SECRET: ${{ secrets.JWT_SECRET }}
- name: Find signed XPI file name
id: find-xpi
run: |
XPI_FILE=$(ls ./artifacts/*.xpi)
echo "xpi_name=$(basename "$XPI_FILE" .xpi)" >> $GITHUB_OUTPUT
- name: Extract version for tag and release name
id: extract-version
run: |
XPI_NAME="${{ steps.find-xpi.outputs.xpi_name }}"
VERSION_PART=$(echo "$XPI_NAME" | cut -d '-' -f 2)
echo "version=$VERSION_PART" >> $GITHUB_OUTPUT
- name: Copy signed XPI to real name
id: copy-xpi
run: |
cp ./artifacts/${{ steps.find-xpi.outputs.xpi_name }}.xpi ./artifacts/quick_abstract.xpi
- name: Configure Git
run: |
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}"
git config --global user.name "${{ secrets.GIT_USER_NAME }}"
- name: Upload signed XPI as quick_abstract.xpi
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/quick_abstract.xpi
name: quick_abstract-${{ steps.extract-version.outputs.version }}
tag_name: v${{ steps.extract-version.outputs.version }}
draft: false
prerelease: false
make_latest: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}