-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
136 lines (128 loc) · 4.74 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
default:
image: node:12-buster
cache:
key:
files:
- package.json
paths:
- node_modules
stages:
- buildenv
- check
- package
- release
build-docker-ci-images:
stage: buildenv
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
changes:
- build-containers/*
allow_failure: false
when: always
- if: '$CI_COMMIT_BRANCH == "master"'
when: manual
allow_failure: true
image: docker:19.03.12
services:
- docker:19.03.12-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/tonyfinn/preserve/node:latest build-containers/node
- docker build -t $CI_REGISTRY/tonyfinn/preserve/electronbuilder-linux:latest build-containers/electronbuilder-linux
- docker build -t $CI_REGISTRY/tonyfinn/preserve/electronbuilder-wine:latest build-containers/electronbuilder-wine
- docker push $CI_REGISTRY/tonyfinn/preserve/node:latest
- docker push $CI_REGISTRY/tonyfinn/preserve/electronbuilder-linux:latest
- docker push $CI_REGISTRY/tonyfinn/preserve/electronbuilder-wine:latest
check:
image: $CI_REGISTRY/tonyfinn/preserve/node:latest
stage: check
cache:
policy: push
artifacts:
paths:
- dist/
- preserve-ui/cypress/
reports:
junit: preserve-ui/cypress/results-*.xml
script:
- make clean dist check
package-web:
image: $CI_REGISTRY/tonyfinn/preserve/node:latest
stage: package
rules:
- if: $CI_COMMIT_TAG
when: on_success
cache:
policy: pull
artifacts:
expire_in: never
paths:
- target/*
script:
- make package-web
package-electron-linux:
image: $CI_REGISTRY/tonyfinn/preserve/electronbuilder-linux:latest
stage: package
rules:
- if: $CI_COMMIT_TAG
when: on_success
cache:
policy: pull
artifacts:
expire_in: never
paths:
- target/*
script:
- make package-electron-linux
package-electron-windows:
stage: package
image: $CI_REGISTRY/tonyfinn/preserve/electronbuilder-wine:latest
rules:
- if: $CI_COMMIT_TAG
when: on_success
cache:
policy: pull
artifacts:
expire_in: never
paths:
- target/*
script:
- make package-electron-windows
docker:
stage: package
services:
- docker:19.03-dind
image: docker:19.03
cache:
policy: pull
artifacts:
expire_in: never
paths:
- target/*
rules:
- if: $CI_COMMIT_TAG
when: on_success
script:
- apk add make jq
- mkdir -p target/
- echo -n $DOCKER_PASSWORD | docker login -u tonyfinn --password-stdin https://index.docker.io/v1/
- make docker && make publish-docker
- docker images --no-trunc --quiet tonyfinn/preserve:latest > target/docker-tag.txt
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:edge
rules:
- if: $CI_COMMIT_TAG
when: on_success
script:
- >
VERSION=$(echo $CI_COMMIT_TAG | tr -d 'v') &&
DOCKER_SHA=$(cat target/docker-tag.txt | tr ':' '-') &&
CHANGELOG=$(awk '/^# /{f=1} f; /^# / && ++c==2{exit}' CHANGELOG.md | head -n -1) &&
release-cli create --name $CI_COMMIT_TAG --description "$CHANGELOG"
--tag-name $CI_COMMIT_TAG --ref $CI_COMMIT_SHA
--assets-link "{\"name\":\"Windows Installer (Desktop App)\",\"url\":\"https://gitlab.com/tonyfinn/preserve/-/jobs/artifacts/v${VERSION}/raw/target/Preserve-${VERSION}%20Setup.exe?job=package-electron-windows\",\"link_type\":\"package\"}"
--assets-link "{\"name\":\".rpm for Fedora (Desktop App)\",\"url\":\"https://gitlab.com/tonyfinn/preserve/-/jobs/artifacts/v${VERSION}/raw/target/preserve-electron-${VERSION}-1.x86_64.rpm?job=package-electron-linux\",\"link_type\":\"package\"}"
--assets-link "{\"name\":\".deb for Debian/Ubuntu (Desktop App)\",\"url\":\"https://gitlab.com/tonyfinn/preserve/-/jobs/artifacts/v${VERSION}/raw/target/preserve-electron_${VERSION}_amd64.deb?job=package-electron-linux\",\"link_type\":\"package\"}"
--assets-link "{\"name\":\"Packaged Web Application\",\"url\":\"https://gitlab.com/tonyfinn/preserve/-/jobs/artifacts/v${VERSION}/raw/target/preserve-${VERSION}.tar.gz?job=package-web\",\"link_type\":\"package\"}"
--assets-link "{\"name\":\"Docker image\",\"url\":\"https://hub.docker.com/layers/tonyfinn/preserve/${VERSION}/images/${DOCKER_SHA}?context=repo\",\"link_type\":\"image\"}"