-
Notifications
You must be signed in to change notification settings - Fork 34
/
.gitlab-ci.yml
137 lines (128 loc) · 5.14 KB
/
.gitlab-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
stages:
- compiling
- publishing
image: passwords-webextension-builder
Compile Firefox:
stage: compiling
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
- mkdir dist
- npm ci
- npm run build:firefox
- if [ "${CI_COMMIT_REF_NAME}" == "stable" ] ; then sed -i -e "s|.BUILD||g" ./build/manifest.json ; fi
- if [ "${CI_COMMIT_REF_NAME}" != "stable" ] ; then sed -i -e "s|BUILD|${CI_PIPELINE_ID}|g" ./build/manifest.json ; fi
- sed -i -e "s|CI_COMMIT_REF_NAME|${CI_COMMIT_REF_NAME}|g" ./build/html/build.html
- sed -i -e "s|CI_PROJECT_NAME|${CI_PROJECT_NAME}|g" ./build/html/build.html
- sed -i -e "s|CI_PROJECT_URL|${CI_PROJECT_URL}|g" ./build/html/build.html
- sed -i -e "s|CI_PIPELINE_ID|${CI_PIPELINE_ID}|g" ./build/html/build.html
- sed -i -e "s|CI_COMMIT_SHA|${CI_COMMIT_SHA}|g" ./build/html/build.html
- sed -i -e "s|CI__|CI_|g" ./build/html/build.html
- mv build dist/firefox-extension
artifacts:
expire_in: 1 week
paths:
- ./dist/firefox-extension
only:
- stable
- testing
Compile Chrome:
stage: compiling
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
- mkdir dist
- npm ci
- npm run build:chrome
- sed -i -e "s|99999|${CI_PIPELINE_ID}|g" ./build/manifest.json
- sed -i -e "s|CI_COMMIT_REF_NAME|${CI_COMMIT_REF_NAME}|g" ./build/html/build.html
- sed -i -e "s|CI_PROJECT_NAME|${CI_PROJECT_NAME}|g" ./build/html/build.html
- sed -i -e "s|CI_PROJECT_URL|${CI_PROJECT_URL}|g" ./build/html/build.html
- sed -i -e "s|CI_PIPELINE_ID|${CI_PIPELINE_ID}|g" ./build/html/build.html
- sed -i -e "s|CI_COMMIT_SHA|${CI_COMMIT_SHA}|g" ./build/html/build.html
- sed -i -e "s|CI__|CI_|g" ./build/html/build.html
- mv build dist/chrome-extension
artifacts:
expire_in: 1 week
paths:
- ./dist/chrome-extension
only:
- v3/stable
- v3/testing
Publish Nightly Firefox:
stage: publishing
script:
- 'export EXT_VERSION=$(node -p "require(\"./dist/firefox-extension/manifest.json\").version")'
- 'PACKAGE_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/passwords-webextension-nightly/latest/firefox-webextension-${EXT_VERSION}.xpi"'
- 'UPDATE_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/passwords-webextension-nightly/latest/updates.json"'
- 'sed -i -e "s|\"gecko\": {|\"gecko\":{\"update_url\":\"UPDATE_URL\",|g" ./dist/firefox-extension/manifest.json'
- 'sed -i -e "s|UPDATE_URL|${UPDATE_URL}|g" ./dist/firefox-extension/manifest.json'
- 'web-ext sign --channel unlisted --ignore-files updates.json'
- 'sed -i -e "s|VERSION|${EXT_VERSION}|g" ./dist/firefox-extension/updates.json'
- 'sed -i -e "s|ARTIFACT_URL|${PACKAGE_URL}|g" ./dist/firefox-extension/updates.json'
- 'export EXT_FILENAME=$(cd ./dist/firefox-extension/ && ls *.xpi)'
- 'export SHA_512=$(sha512sum ./dist/firefox-extension/${EXT_FILENAME} | cut -d\ -f 1)'
- 'sed -i -e "s|SHA_512|${SHA_512}|g" ./dist/firefox-extension/updates.json'
- 'export CHANGELOG_URL=${CI_PROJECT_URL}/raw/${CI_COMMIT_SHA}/Changelog.md'
- 'sed -i -e "s|CHANGELOG_URL|${CHANGELOG_URL}|g" ./dist/firefox-extension/updates.json'
- 'curl --retry 5 --retry-all-errors --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ./dist/firefox-extension/${EXT_FILENAME} "${PACKAGE_URL}"'
- 'curl --retry 5 --retry-all-errors --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ./dist/firefox-extension/updates.json "${UPDATE_URL}"'
- 'echo "Firefox Extension package available at ${PACKAGE_URL}"'
environment:
name: Testing
only:
- testing
Publish Nightly Chrome:
stage: publishing
allow_failure: true
script:
- 'export WEXT_SHIPIT_CHROME_EXTENSION_ID=${CHROME_EXTENSION_ID_TESTING}'
- 'shipit chrome dist/chrome-extension'
environment:
name: Testing
only:
- v3/testing
Publish Nightly Edge:
stage: publishing
script:
- 'export EXT_VERSION=$(node -p "require(\"./dist/chrome-extension/manifest.json\").version")'
- 'PACKAGE_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/passwords-webextension-nightly/latest/edge-webextension-${EXT_VERSION}.zip"'
- 'cd dist/chrome-extension'
- 'zip -r -9 ../../edge-extension.zip ./*'
- 'cd ../../'
- 'curl --retry 5 --retry-all-errors --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ./edge-extension.zip "${PACKAGE_URL}"'
- 'echo "Edge Extension package available at ${PACKAGE_URL}"'
environment:
name: Testing
only:
- v3/testing
Publish Stable Firefox:
stage: publishing
script:
- 'rm dist/firefox-extension/updates.json'
- 'web-ext sign --use-submission-api --channel listed'
environment:
name: Stable
only:
- stable
Publish Stable Chrome:
stage: publishing
script:
- 'export WEXT_SHIPIT_CHROME_EXTENSION_ID=${CHROME_EXTENSION_ID_STABLE}'
- 'shipit chrome dist/chrome-extension'
environment:
name: Stable
only:
- v3/stable
Publish Stable Edge:
stage: publishing
script:
- 'npm ci'
- 'cd dist/chrome-extension'
- 'zip -r -9 ../../edge-extension.zip ./*'
- 'cd ../../'
- 'npm run edge:publish'
environment:
name: Stable
only:
- v3/stable