This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
154 lines (142 loc) · 3.41 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# SPDX-FileCopyrightText: Night Theme Switcher Contributors
# SPDX-License-Identifier: GPL-3.0-or-later
variables:
PACKAGE_NAME: nightthemeswitcher.zip
PACKAGE_REGISTRY_URL: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/nightthemeswitcher
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "web"
stages:
- check
- build
- deploy
.python:
image: python:latest
variables:
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
cache:
key: python
paths:
- .cache/pip
- venv/
before_script:
- python -V
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
.node:
image: node:latest
cache:
key: node
paths:
- node_modules
before_script:
- npm install --save-dev
lint:
extends: .node
stage: check
interruptible: true
rules:
- changes:
- src/**/*.js
script:
- npm run test-lint
reuse:
image:
name: fsfe/reuse:latest
entrypoint: [""]
stage: check
interruptible: true
script:
- reuse lint
extension:
stage: build
interruptible: true
needs:
- job: lint
optional: true
- reuse
image: debian:stable-slim
before_script:
- apt update
- apt install --no-install-recommends -y gettext libglib2.0-bin libglib2.0-dev-bin meson zip
script:
- if [ -z "$CI_COMMIT_TAG" ]; then BUILD_TYPE=debug; else BUILD_TYPE=release; fi
- meson builddir -Dbuildtype=$BUILD_TYPE -Dpack=true -Dpackdir=.
- meson install -C builddir
artifacts:
name: $CI_COMMIT_REF_NAME
expose_as: Extension
paths:
- nightthemeswitcher@romainvigier.fr.zip
expire_in: 1 day
package:
stage: deploy
needs:
- job: extension
artifacts: true
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- |
curl \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file nightthemeswitcher@romainvigier.fr.zip \
"${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/${PACKAGE_NAME}"
release-notes:
extends: .python
stage: deploy
needs:
- reuse
rules:
- if: $CI_COMMIT_TAG
script:
- ./build-aux/get_release_notes.py $CI_COMMIT_TAG > release-notes.md
artifacts:
paths:
- release-notes.md
expire_in: 1 day
release:
stage: deploy
needs:
- package
- job: release-notes
artifacts: true
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- echo "Creating release for version $CI_COMMIT_TAG"
release:
name: Version $CI_COMMIT_TAG
tag_name: $CI_COMMIT_TAG
description: release-notes.md
assets:
links:
- name: Night Theme Switcher v${CI_COMMIT_TAG}
url: ${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/${PACKAGE_NAME}
filepath: /${PACKAGE_NAME}
link_type: package
pages:
stage: deploy
needs: []
image: debian:stable-slim
before_script:
- apt update
- apt install --no-install-recommends -y gzip brotli
script:
- cp -r website public
- find public -type f -regex '.*\.\(|html\|css\|svg\|png\|woff\|woff2\)$' -exec gzip -f -k {} \;
- find public -type f -regex '.*\.\(|html\|css\|svg\|png\|woff\|woff2\)$' -exec brotli -f -k {} \;
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- website/**/*
artifacts:
paths:
- public
expire_in: 1 day