-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
35 lines (33 loc) · 1.02 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
variables:
GIT_STRATEGY: clone
stages:
- github-release
github-release:
stage: github-release
image: alpine:3.17
cache: []
tags:
- docker
before_script:
- apk add --no-cache git openssh curl sed jq
# Configure git credentials
- git config --global user.email "$GITHUB_RELEASE_EMAIL"
- git config --global user.name "$GITHUB_RELEASE_USERNAME"
# Configure SSH private key for github.com and add to known hosts
- mkdir -p ~/.ssh
- echo "$GITHUB_RELEASE_SSH_KEY" > ~/.ssh/id_rsa
- chmod 400 ~/.ssh/id_rsa
- curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | sed -e 's/^/github.com /' >> ~/.ssh/known_hosts
script:
- git checkout $CI_COMMIT_REF_NAME
- git remote add github $GITHUB_RELEASE_REPO
- git fetch github
- git checkout github/main
- git merge -X theirs $CI_COMMIT_REF_NAME --allow-unrelated-histories --squash
- git commit -m "$CI_COMMIT_TAG_MESSAGE"
- git push github HEAD:main
only:
- tags
except:
- schedules
when: manual