blob: 90890f3924cc29540a352f1bf778f8a392f2e38e (
plain)
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
|
image: archlinux:base-devel
# Cache directories to speed up consecutive builds
cache:
key: system-v1
paths:
- .pkg-cache
- .venv
- .pre-commit
variables:
PACKAGE_NAME: "auto_facelock"
CURRENT_DIR: "$(pwd)"
# Define stages
stages:
- lint
- build
- archive
- publish
# Lint stage
lint:
stage: lint
before_script:
- pacman -Sy --noconfirm --noprogressbar --cachedir .pkg-cache archlinux-keyring
- pacman -Syu --noconfirm --noprogressbar --cachedir .pkg-cache git python python-pre-commit
script:
- export XDG_CACHE_HOME=.pre-commit
- pre-commit run -a
# Build stage
build_package:
stage: build
script:
- pacman -Syu --noconfirm --needed --cachedir .pkg-cache git yay
- makepkg --printsrcinfo > .SRCINFO
- makepkg -si --noconfirm
artifacts:
paths:
- "*.pkg.tar.*"
- "*.src.tar.gz"
expire_in: 1 week
# Archive stage
rename_artifacts:
stage: archive
script:
- mkdir -p artifacts
- COMMIT_HASH=$(git rev-parse --short HEAD)
- mv *.pkg.tar.* "artifacts/${PACKAGE_NAME}-${COMMIT_HASH}.pkg.tar.xz"
- mv *.src.tar.gz "artifacts/${PACKAGE_NAME}-${COMMIT_HASH}.src.tar.gz"
dependencies:
- build_package
artifacts:
paths:
- artifacts/
expire_in: 1 week
# Publish stage (optional)
publish_to_aur:
stage: publish
script:
- pacman -S --noconfirm --needed --cachedir .pkg-cache openssh
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$AUR_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- git remote add aur ssh://aur@aur.archlinux.org/your-aur-package.git
- git push aur main
dependencies:
- rename_artifacts
environment:
name: production
when: manual
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
when: manual
|