-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
80 lines (77 loc) · 2.93 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
include:
- template: Auto-DevOps.gitlab-ci.yml
test:
stage: test
image: ghcr.io/acdh-oeaw/herokuish-for-cypress/main:latest
needs: []
services: []
script:
- cp -R . /tmp/app
- export CYPRESS_VIDEOS_FOLDER=${CI_PROJECT_DIR}/cypress/videos
- export CYPRESS_SCREENSHOTS_FOLDER=${CI_PROJECT_DIR}/cypress/videos
- /bin/herokuish buildpack test
- TEST_STATUS=$?
- cp -Rv /app/coverage /app/tests/e2e . || true
- echo "Test exit code $TEST_STATUS"
- exit $TEST_STATUS
rules:
- if: '$TEST_DISABLED'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
artifacts:
when: always
paths:
# save both cypress artifacts and coverage results
- coverage
- cypress/videos/**/*.mp4
- cypress/screenshots/**/*.png
- e2e/videos/**/*.mp4
- e2e/screenshots/**/*.png
expire_in: 10 days
mirror-on-github:
stage: review
image: bitnami/git
script: |
set -eo pipefail
apt-get update && apt-get install -y podman
git config --global user.email "[email protected]"
git config --global user.name "ACDH-CH filter bot"
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
git fetch --unshallow origin
git remote set-url origin https://${GITLAB_WRITE_USER}:${GITLAB_WRITE_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
current_branch=$(git branch -a --contains $(git show-ref -s $CI_COMMIT_REF_NAME) | sed 's~remotes/origin/~~' | grep -v HEAD | grep -v 'no branch' | grep -v '/' | tail -n 1)
tag=$(git describe --tags --abbrev=0)
msg=$(git tag -l --format='%(contents)' $tag)
echo "current branch: $current_branch tag: $tag message: $msg"
git checkout $current_branch
to_revert=$(git rev-parse HEAD)
git checkout origin/main -B main
git merge --squash --allow-unrelated-histories $to_revert -s ort -X theirs || ":"
git submodule update --init --force --checkout
git submodule -q foreach git add .
# force the article API endpoint to the restricted one
sed -i "s~https://wboe-api-retro.acdh-dev.oeaw.ac.at/~https://wboe-curation.acdh-dev.oeaw.ac.at/~g" ./server/server.ts
git commit -a -m "$msg"
git tag "$tag-release" -m "$msg"
git push origin main
git push origin "$tag-release"
git remote add public https://filter:${GITHUB_WRITE_TOKEN}@github.com/acdh-oeaw/lioe-public-frontend.git
git pull public main
git push public main
git push public "$tag-release"
git checkout $current_branch
rules:
- if: '$CI_DEPLOY_FREEZE'
when: never
- if: '($CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == "") && ($KUBECONFIG == null || $KUBECONFIG == "")'
when: never
- if: '$STAGING_ENABLED'
when: never
- if: '$CANARY_ENABLED'
when: never
- if: '$INCREMENTAL_ROLLOUT_ENABLED'
when: never
- if: '$INCREMENTAL_ROLLOUT_MODE'
when: never
# Runs only when a tag with '0.0.0' pattern is created
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'