.gitlab-ci.yml 1.38 KB
Newer Older
1
2
default:
  image: "archlinux:latest"
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
3

4
stages:
5
  - lint
6
  - build
7
  - publish
8

Christian Rebischke's avatar
Christian Rebischke committed
9
shellcheck:
10
  stage: lint
11
12
  before_script:
    - pacman -Syu --needed --noconfirm shellcheck
Christian Rebischke's avatar
Christian Rebischke committed
13
  script:
14
    - shellcheck **/*.sh
Christian Rebischke's avatar
Christian Rebischke committed
15
16

shfmt:
17
  stage: lint
18
19
  before_script:
    - pacman -Syu --needed --noconfirm shfmt
Christian Rebischke's avatar
Christian Rebischke committed
20
  script:
21
    - shfmt -i 2 -ci -d **/*.sh
Christian Rebischke's avatar
Christian Rebischke committed
22

23
.build:
24
  stage: build
25
  before_script:
26
    - pacman -Syu --needed --noconfirm qemu-headless libisoburn
27
  script:
28
29
    - echo "BUILD_DATE=$(date -I)" > build.env
    - . build.env
30
    - ./build-in-qemu.sh
31
    - mv build.env output/
32
33
34
35
36
37
38
39
40
41
42
43

build:
  extends: .build
  except:
    - master

build:release:
  extends: .build
  tags:
    - secure
  only:
    - master
44
  artifacts:
45
    name: "output"
46
    paths:
47
      - "output/*"
48
    expire_in: 2d
49
50
51
52

publish:
  stage: publish
  tags:
53
    - secure
54
  before_script:
55
    - pacman -Syu --needed --noconfirm vagrant
56
  script:
57
58
    - . output/build.env
    - vagrant cloud auth login --token "${VAGRANT_API_TOKEN}"
59
60
    - vagrant cloud auth login --check
    - vagrant cloud box show archlinux/archlinux
61
62
    - vagrant cloud publish archlinux/archlinux "v${BUILD_DATE}" libvirt output/Arch-Linux-x86_64-libvirt-*.box --release -f
    - vagrant cloud publish archlinux/archlinux "v${BUILD_DATE}" virtualbox output/Arch-Linux-x86_64-virtualbox-*.box --release -f
63
64
65
  only:
    variables:
      - $SCHEDULED_PUBLISH == "TRUE"
66
  resource_group: vm-build