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
|
# Pipeline CI/CD re:group
# - lint : web-ext lint sur chaque push / MR
# - secret-detection : scan de secrets (template GitLab)
# - sign : soumet + signe la version sur AMO (listed) sur tag vX.Y.Z
#
# Variables CI à définir (Settings > CI/CD > Variables), masked + protected :
# WEB_EXT_API_KEY (jwtIssuer depuis AMO > Manage API Keys)
# WEB_EXT_API_SECRET (jwtSecret)
# web-ext lit ces deux variables automatiquement : jamais passées en argument.
#
# Le job sign ne tourne que sur tags PROTÉGÉS (motif v* à protéger dans
# Settings > Repository > Protected tags) → seuls les tags protégés voient
# les variables protégées. AMO gère la distribution et les mises à jour.
stages:
- test
- secret-detection
- sign
variables:
SECRET_DETECTION_ENABLED: 'true'
include:
- template: Security/Secret-Detection.gitlab-ci.yml
secret_detection:
stage: secret-detection
# ---------------------------------------------------------------------------
# Lint — rapide, sur branches et MR (attrape ce qu'AMO refuserait).
# ---------------------------------------------------------------------------
lint:
stage: test
image: node:20
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_TAG == null && $CI_PIPELINE_SOURCE == "push"'
script:
- npm install --no-save web-ext@^10
- npx web-ext lint --source-dir=.
# ---------------------------------------------------------------------------
# Sign — sur tag vX.Y.Z. Vérifie que le manifest == le tag, puis soumet et
# signe la version sur AMO (canal listed). La licence est passée via
# amo-metadata.json (obligatoire pour une version listed).
# ---------------------------------------------------------------------------
sign:
stage: sign
image: node:20
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
script:
- VERSION="${CI_COMMIT_TAG#v}"
- MANIFEST_VERSION="$(node -p "require('./manifest.json').version")"
- |
if [ "$VERSION" != "$MANIFEST_VERSION" ]; then
echo "Le tag ($VERSION) ne correspond pas à manifest.json ($MANIFEST_VERSION)."
exit 1
fi
- npm install --no-save web-ext@^10
# WEB_EXT_API_KEY / WEB_EXT_API_SECRET lus depuis l'environnement.
- npx web-ext sign --channel=listed --amo-metadata=amo-metadata.json --source-dir=. --artifacts-dir=signed
artifacts:
paths:
- signed/
expire_in: 1 month
|