-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
95 lines (87 loc) · 3.36 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
# (c) https://github.com/MontiCore/monticore
image: registry.git.rwth-aachen.de/monticore/container-registry/gradle:7.6.4-jdk11
stages:
- build
- deploy
- mirror
- trigger_mc
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
build:
stage: build
script:
- "gradle build $GRADLE_OPT $ARGS1"
artifacts:
paths:
- "target/"
- ".gradle/"
expire_in: 1 week
deploy:
stage: deploy
dependencies:
- build
script:
- "gradle publish -PmavenPassword=$pass -PmavenUser=$user $GRADLE_OPT $ARGS2"
only:
- dev
except:
- master
trigger_mc_dev:
stage: trigger_mc
trigger:
project: monticore/monticore
branch: dev
only:
- dev
trigger_montiverse:
stage: trigger_mc
trigger:
project: monticore/montiverseci
variables:
SECOMMONS_BRANCH: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
FULL_MC: "true" # also run MontiCore experiments
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# Mirrors this repository's `develop` and `master` branches to GitHub.
#
# The mirror will always be at either HEAD or HEAD+1 (depending on whether cleanup is necessary).
# For more information, visit: https://git.rwth-aachen.de/se/infrastructure/github-mirror-tools (Available internally only)
githubmirror:
# We need a JDK 17+ image for this job since the link checker requires Java 17.
image: eclipse-temurin:17-jdk-alpine
stage: mirror
variables:
# The repository is edited during this job. To make sure that no changes persist, we instruct GitLab to always
# create a fresh clone of the repository instead of caching it and attempting to remove any changes.
#
# See https://docs.gitlab.com/ee/ci/runners/configure_runners.html#git-strategy
GIT_STRATEGY: clone
dependencies: []
before_script:
- 'apk --no-cache add curl git openssh-client'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SE_CIBUILD_SSH_PRIV_KEY")
- echo "$SE_CIBUILD_SSH_PRIV_KEY" | tr -d '\r' | ssh-add -
- git config --global user.email "[email protected]"
- git config --global user.name "MontiCore Mirroring Bot"
- git checkout "$CI_COMMIT_REF_NAME" # GitLab checks out a commit in detached HEAD mode by default, but we want to commit to the branch and push.
- mkdir -p ~/.ssh
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
script:
- 'curl --location --header "PRIVATE-TOKEN: $secibuildinfstrtoken" "https://git.rwth-aachen.de/api/v4/projects/se%2Finfrastructure%2Fgithub-mirror-tools/repository/files/mirror.sh/raw" --output mirror.sh'
- sh mirror.sh
- rm mirror.sh
- 'curl --location --header "PRIVATE-TOKEN: $secibuildinfstrtoken" "https://git.rwth-aachen.de/api/v4/projects/se%2Finfrastructure%2Fmdlinkchecker/jobs/artifacts/master/raw/target/libs/MDLinkCheckerCLI.jar?job=build" --output MDLinkChecker.jar'
- 'java -jar MDLinkChecker.jar -t "$secibuildtoken" -r . -p -c -i'
- 'rm MDLinkChecker.jar'
- git add --all
# We'll simply ignore failures during commit because there is a chance that no files were changed. In this case the
# remote will be on the same commit as the upstream repository.
- (git commit -m "[Mirror] Replace all internal links and references") || true
- git remote add github [email protected]:MontiCore/se-commons.git
- git push github $CI_COMMIT_BRANCH --force
#only:
# - dev
# - master
rules:
- when: never