-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
53 lines (47 loc) · 1.82 KB
/
.gitlab-ci.yml
File metadata and controls
53 lines (47 loc) · 1.82 KB
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
# List of stages for jobs, and their order of execution
stages:
- package
- upload
- release
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
ZIP: $CI_PROJECT_NAME-$CI_COMMIT_TAG.zip
PACKAGE_VERSION: $CI_COMMIT_TAG
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${PACKAGE_VERSION}"
.release_job:
rules:
# Only execute when a valid version tag like 1.0, 2.3-dev or similar is given
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_TAG =~ /^[0-9]+[.][0-9]+([.][0-9]+)?([-a-z])*$/
package:
extends: .release_job
image: javieraviles/zip:latest
stage: package
script:
- mkdir autoverifactu
- mv admin class core css env.php img langs lib LICENSE README.md autoverifactu
- zip -r $ZIP autoverifactu
artifacts:
paths:
- $ZIP
upload:
extends: .release_job
stage: upload
image: curlimages/curl:latest
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${ZIP} ${PACKAGE_REGISTRY_URL}/${ZIP}
release:
# Caution, as of 2021-02-02 these assets links require a login, see:
# https://gitlab.com/gitlab-org/gitlab/-/issues/299384
extends: .release_job
stage: release
image: gitlab/glab:latest
variables:
GITLAB_HOST: "$CI_SERVER_URL"
script:
- glab auth login --job-token $CI_JOB_TOKEN --hostname $CI_SERVER_HOST --api-protocol $CI_SERVER_PROTOCOL
- |
glab release create $CI_COMMIT_TAG --name "Release $CI_COMMIT_TAG" \
--assets-links "[{\"name\":\"${ZIP}\",\"url\":\"${PACKAGE_REGISTRY_URL}\/${ZIP}\",\"link_type\":\"package\",\"direct_asset_path\":\"\/modules\/${ZIP}\"}]"