forked from Pylogmon/earth_wallpaper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
55 lines (50 loc) · 2.24 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
stages:
- package
- upload
- release
package:
stage: package
image: ubuntu:20.04
script:
- apt-get update && apt-get install -y git
- |
sed -i "s/Version:.*/Version: $(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')/g" deb/DEBIAN/control
sed -i "s/return \".*/return \"$(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')\"/g" earth_wallpaper/about.py
- mkdir -p deb/opt/earth-wallpaper
- cp -r earth_wallpaper deb/opt/earth-wallpaper/earth_wallpaper
- chmod 755 deb/DEBIAN/* && chmod 755 deb/DEBIAN
- dpkg -b deb earth-wallpaper-amd64.deb
artifacts:
paths:
- earth-wallpaper-amd64.deb
upload:
stage: upload
image: curlimages/curl:latest
variables:
# Package version can only contain numbers (0-9), and dots (.).
# Must be in the format of X.Y.Z, i.e. should match /\A\d+\.\d+\.\d+\z/ regular expresion.
# See https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-package-file
PACKAGE_VERSION: "${CI_COMMIT_TAG}"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/earth_wallpaper/${PACKAGE_VERSION}"
rules:
- if: $CI_COMMIT_TAG
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file earth-wallpaper-amd64.deb "${PACKAGE_REGISTRY_URL}/earth-wallpaper-amd64-$CI_COMMIT_TAG.deb"
release:
# Caution, as of 2021-02-02 these assets links require a login, see:
# https://gitlab.com/gitlab-org/gitlab/-/issues/299384
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
variables:
# Package version can only contain numbers (0-9), and dots (.).
# Must be in the format of X.Y.Z, i.e. should match /\A\d+\.\d+\.\d+\z/ regular expresion.
# See https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-package-file
PACKAGE_VERSION: "${CI_COMMIT_TAG}"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/earth_wallpaper/${PACKAGE_VERSION}"
rules:
- if: $CI_COMMIT_TAG
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"earth-wallpaper-amd64-$CI_COMMIT_TAG.deb\",\"url\":\"${PACKAGE_REGISTRY_URL}/earth-wallpaper-amd64-$CI_COMMIT_TAG.deb\"}"