-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
185 lines (177 loc) · 4.33 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
.build_setup_steps: &build_setup_steps
before_script:
- mkdir -p /opt/IronFox
- echo "$SB_GAPI_KEY" > "$SB_GAPI_KEY_FILE"
- |
curl \
--request GET \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
"${CI_API_V4_URL}/projects/$CI_PROJECT_ID/secure_files/$KEYSTORE_SECFILEID/download" \
--output "$KEYSTORE"
variables: &build_variables
PRODUCTION_BRANCH: main
VERSION_NAME: "135.0.0"
SB_GAPI_KEY_FILE: /opt/IronFox/sb-gapi.data
KEYSTORE: /opt/IronFox/signing-key.jks
BUNDLETOOL: 1.18.0
stages:
- build_fdroid
- build_docker
- build_ironfox
- release
update-fdroid-repo:
image: fedora:41
stage: build_fdroid
rules:
- if: $CI_COMMIT_TAG
variables:
TARGET_REPO_PATH: ironfox-oss/fdroid
TARGET_REPO_BRANCH: dev
META_FILE: "./fdroid/metadata/org.ironfoxoss.ironfox.yml"
REPO_DIR: "./fdroid/repo"
<<: *build_variables
before_script:
- sudo dnf install -y bash curl git jq make python3 python3-pip
- pip install androguard
- git config --global user.email "[email protected]"
- git config --global user.name "IronFox CI"
script:
- bash -x scripts/ci-update-fdroid.sh
build-docker:
image: docker:cli
stage: build_docker
services:
- docker:dind
variables:
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$DOCKER_IMAGE_NAME" .
- docker push "$DOCKER_IMAGE_NAME"
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
docker tag "$DOCKER_IMAGE_NAME" "$CI_REGISTRY_IMAGE:latest"
docker push "$CI_REGISTRY_IMAGE:latest"
fi
rules:
- if: $CI_COMMIT_BRANCH
exists:
- Dockerfile
changes:
- Dockerfile
- if: $CI_COMMIT_BRANCH == $PRODUCTION_BRANCH
build-apk:
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
stage: build_ironfox
timeout: 2h
needs:
- job: "build-docker"
optional: true
tags:
- saas-linux-xlarge-amd64
parallel:
matrix:
- VERSION_CODE: ["31350000", "31350010", "31350020"]
variables:
<<: *build_variables
<<: *build_setup_steps
script:
- bash -x scripts/ci-build.sh
artifacts:
untracked: false
when: on_success
access: all
expire_in: "30 days"
paths:
- $CI_PROJECT_DIR/artifacts/apk/**/*
- $CI_PROJECT_DIR/artifacts/aar/**/*
except:
changes:
- "*.md"
- assets/*
- .gitignore
- LICENSE
build-apk-set:
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
stage: build_ironfox
timeout: 2h
needs:
- job: "build-docker"
optional: true
- job: "build-apk"
artifacts: true
optional: false
tags:
- saas-linux-xlarge-amd64
variables:
VERSION_CODE: "31350030"
<<: *build_variables
<<: *build_setup_steps
script:
- bash -x scripts/ci-build.sh
artifacts:
untracked: false
when: on_success
access: all
expire_in: "30 days"
paths:
- $CI_PROJECT_DIR/artifacts/apks/**/*
except:
changes:
- "*.md"
- assets/*
- .gitignore
- LICENSE
prepare-release:
image: alpine:latest
stage: release
interruptible: true
needs:
- job: "build-docker"
optional: true
- job: "build-apk"
artifacts: true
optional: true
- job: "build-apk-set"
artifacts: true
optional: true
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH == $PRODUCTION_BRANCH
variables:
<<: *build_variables
before_script:
- apk add --update --no-cache bash curl jq
script:
- bash -x scripts/ci-publish-packages.sh
artifacts:
untracked: false
when: on_success
access: all
expire_in: "30 days"
paths:
- build/release.yml
publish-release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: release
interruptible: true
needs:
- job: "prepare-release"
artifacts: true
optional: false
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH == $PRODUCTION_BRANCH
variables:
<<: *build_variables
script:
- |
release-cli \
--server-url "$CI_SERVER_URL" \
--project-id "$CI_PROJECT_ID" \
--private-token "$GITLAB_CI_API_TOKEN" \
create-from-file \
--file build/release.yml