-
Notifications
You must be signed in to change notification settings - Fork 8
150 lines (133 loc) · 4.33 KB
/
ci.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
name: "Build"
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
outputs:
name: ${{ steps.web-ext-build.outputs.name }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Code Lint"
run: npm run lint
- name: "Yamllint"
run: yamllint -c .yamllint.yml .
- name: "Bump version with run id"
run: |
export VERSION="1.$((10#${GITHUB_RUN_ID:0:4})).$((10#${GITHUB_RUN_ID:4}))"
jq ".version = \"$VERSION\"" test/extension/manifest.json > manifest.json~
mv manifest.json~ test/extension/manifest.json
git diff test/extension
- name: "Self-test: lint"
id: web-ext-lint
uses: "./"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
cmd: lint
source: test/extension
channel: unlisted
- name: "Self-test: build"
id: web-ext-build
uses: "./"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
cmd: build
source: test/extension
channel: unlisted
- name: "Upload unsigned build"
uses: actions/upload-artifact@v4
with:
name: unsigned.xpi
path: ${{ steps.web-ext-build.outputs.target }}
if-no-files-found: error
amo:
name: "Self-test: AMO release"
runs-on: ubuntu-latest
needs: build
env:
HAS_SIGN_KEY: ${{ secrets.AMO_SIGN_KEY != '' && secrets.AMO_SIGN_SECRET != '' }}
steps:
- name: "Checkout"
if: env.HAS_SIGN_KEY
uses: actions/checkout@v4
- name: "Get release build"
if: env.HAS_SIGN_KEY
uses: actions/download-artifact@v4
with:
name: unsigned.xpi
path: web-ext-artifacts
- name: "Bump version with attempt id"
if: env.HAS_SIGN_KEY
working-directory: web-ext-artifacts
run: |
unzip -p ${{ needs.build.outputs.name }} manifest.json | \
jq ".version += \".$GITHUB_RUN_ATTEMPT\"" > manifest.json
zip -u ${{ needs.build.outputs.name }} manifest.json
rm manifest.json
- name: "Collect sources"
if: env.HAS_SIGN_KEY
run: git archive --format=zip --output=sources.zip HEAD
- name: "Release"
if: env.HAS_SIGN_KEY
id: web-ext-sign-amo
uses: "./"
with:
cmd: sign
source: web-ext-artifacts/${{ needs.build.outputs.name }}
sourceCode: sources.zip
channel: unlisted
metaDataFile: test/amo_metadata.json
approvalNotes: "Please find more information at https://github.com/kewisch/action-web-ext"
releaseNotes: "Triggered by ${{ github.event_name }} for ${{ github.sha }}"
license: MPL-2.0
apiKey: ${{ secrets.AMO_SIGN_KEY }}
apiSecret: ${{ secrets.AMO_SIGN_SECRET }}
- name: "Upload AMO signed"
if: env.HAS_SIGN_KEY
uses: actions/upload-artifact@v4
with:
name: amo-signed.xpi
path: ${{ steps.web-ext-sign-amo.outputs.target }}
if-no-files-found: error
atn:
name: "Self-test: ATN release"
runs-on: ubuntu-latest
needs: build
env:
HAS_SIGN_KEY: ${{ secrets.ATN_SIGN_KEY != '' && secrets.ATN_SIGN_SECRET != '' }}
steps:
- name: "Checkout"
if: env.HAS_SIGN_KEY
uses: actions/checkout@v4
- name: "Get release build"
if: env.HAS_SIGN_KEY
uses: actions/download-artifact@v4
with:
name: unsigned.xpi
path: web-ext-artifacts
- name: "Bump version with attempt id"
if: env.HAS_SIGN_KEY
working-directory: web-ext-artifacts
run: |
unzip -p ${{ needs.build.outputs.name }} manifest.json | \
jq ".version += \".$GITHUB_RUN_ATTEMPT\"" > manifest.json
zip -u ${{ needs.build.outputs.name }} manifest.json
rm manifest.json
- name: "Self-test: ATN release"
if: env.HAS_SIGN_KEY
uses: "./"
with:
cmd: sign
source: web-ext-artifacts/${{ needs.build.outputs.name }}
channel: unlisted
apiUrlPrefix: "https://addons.thunderbird.net/api/v4"
apiKey: ${{ secrets.ATN_SIGN_KEY }}
apiSecret: ${{ secrets.ATN_SIGN_SECRET }}