forked from nextcloud/nextcloud-filelink
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
123 lines (113 loc) · 3.45 KB
/
.gitlab-ci.yml
File metadata and controls
123 lines (113 loc) · 3.45 KB
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
# Copyright (C) 2025 Johannes Endres
#
# SPDX-License-Identifier: MIT
variables:
# Get submodules automatically
GIT_SUBMODULE_STRATEGY: normal
# Use more efficient fs driver
DOCKER_DRIVER: overlay2
default:
artifacts:
untracked: false
access: developer
expire_in: "10 days"
# Template for jobs that use node
.node_job:
image: node:lts-alpine
before_script:
- apk add grep
- npm install --loglevel=error
# Cache installed node modules as this might be faster than reinstalling them
cache:
key: node_modules
paths:
- node_modules/
## Jobs
Static Tests:
extends: .node_job
stage: test
interruptible: true
rules:
- if: $CI_COMMIT_TITLE =~ /^(docs|ci|build):/
when: never
# Categorized commit of source
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_COMMIT_TITLE =~ /^(f(ix|eat)!?|perf|test|refactor|style):/
script:
- npx web-ext lint
- npx eslint src
- "! grep -Er --exclude-dir=photon-components-web '(TODO|debug)' src"
REUSE compliance:
stage: test
image:
name: fsfe/reuse:latest
entrypoint: [""]
interruptible: true
rules:
# Categorized commit
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_COMMIT_TITLE =~ /^(docs|ci|build|f(ix|eat)!?|perf|test|refactor|style):/
script:
- reuse lint
Check build tools:
extends: .node_job
stage: test
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_COMMIT_TITLE =~ /^build:/
script:
- npx eslint build-tools
Bump version:
# Autmatically increment the version and add a tag, triggering the release
extends: .node_job
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TITLE =~ /^(feat|fix)!?:/
script:
- apk add git
- LAST_VERSION=`git tag -l | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -n | tail -1`
- NEW_VERSION=`node build-tools/bump-semver.mjs ${CI_COMMIT_TITLE%:*} $LAST_VERSION`
- git tag $NEW_VERSION
# GITLAB_PROJECT_TOKEN must have role "Developer" and scope "write_repository"
- git remote add master ${CI_REPOSITORY_URL/gitlab-ci-token*@/release_bot:$GITLAB_PROJECT_TOKEN@}
- git push --tags master
Deploy to Thunderbird Add-ons:
extends: .node_job
stage: deploy
script:
- node build-tools/version-manifest.mjs $CI_COMMIT_TAG
# web-ext sign always fails (as documented), so manipulate the return code
- "npx web-ext sign || true"
environment:
name: Add-ons for Thunderbird
url: https://addons.thunderbird.net/thunderbird/addon/filelink-nextcloud-owncloud/
rules:
# Only sign tagged releases
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
Create a release:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: Deploy to Thunderbird Add-ons
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
script:
- "true"
release:
description: "$(cat build-tools/release-notes-template.md)\n$CI_COMMIT_MESSAGE"
tag_name: "$CI_COMMIT_TAG"
Build pages:
extends: .node_job
stage: deploy
script:
# This script only works if GITLAB_PROJECT_TOKEN is a valid token
- node build-tools/build-pages.mjs
pages: true
artifacts:
expire_in: 1 hour
environment:
name: "Pages"
url: "$CI_PAGES_URL"
rules:
# Explicit update of documentation
- if: $CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TITLE =~ /^docs:/
# Release that might affect documentation
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'