164 lines
3.6 KiB
YAML
164 lines
3.6 KiB
YAML
# 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
|
|
|
|
style:
|
|
extends: .node
|
|
stage: check
|
|
interruptible: true
|
|
script:
|
|
- npm run test-style
|
|
|
|
reuse:
|
|
image:
|
|
name: fsfe/reuse:latest
|
|
entrypoint: [""]
|
|
stage: check
|
|
interruptible: true
|
|
script:
|
|
- reuse lint
|
|
|
|
extension:
|
|
stage: build
|
|
interruptible: true
|
|
needs:
|
|
- job: lint
|
|
optional: true
|
|
- job: style
|
|
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: Night Theme Switcher $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
|