-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
71 lines (63 loc) · 2.3 KB
/
.gitlab-ci.yml
File metadata and controls
71 lines (63 loc) · 2.3 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
workflow:
rules:
- if: $CI_COMMIT_BRANCH
changes:
- README.md
- .gitlab-ci.yml
when:
never
# Do no allow manually triggered pipelines to prevent duplicates!
# Instead rerun the pipeline created with the last push
- if: $CI_PIPELINE_SOURCE != "push"
when: never
# Only execute when a valid version tag like 1.0, 2.3-dev or similar is given
# Required is always one point like 1.0
- if: $CI_COMMIT_TAG =~ /^[0-9]+[.][0-9]+([.][0-9]+)?([-a-z])*$/
stages: # List of stages for jobs, and their order of execution
- dependencies
- 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.zip
PACKAGE_VERSION: $CI_COMMIT_TAG
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${PACKAGE_VERSION}"
GIT_SUBMODULE_STRATEGY: normal
GIT_SUBMODULE_FORCE_HTTPS: "true"
vendor:
stage: dependencies
image: composer:latest
script:
- composer install --ignore-platform-reqs
artifacts:
paths:
- vendor
package:
image: codeccoop/wp-cli:latest
stage: package
script:
- find common -name '*.php' -exec sed -i "s/'wpct-plugin'/'wc-next-sync'/g" {} \;
- find . -name '*.php' -exec sed -i "s/wpct_plugin_/wc_next_sync_/g" {} \;
- find . -name "*.php" -exec sed -i 's/WPCT_PLUGIN/WC_NEXT_SYNC\\Common/g' {} \;
- wp dist-archive . ./$ZIP
artifacts:
paths:
- $ZIP
upload:
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
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"${ZIP}\",\"url\":\"${PACKAGE_REGISTRY_URL}\/${ZIP}\",\"link_type\":\"package\",\"filepath\":\"\/plugins\/bridges\/${ZIP}\"}"