-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitlab-ci.yml
60 lines (47 loc) · 1.74 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
build-job:
stage: build
image: node:alpine
variables:
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1
before_script:
- ls -lah
- echo "Installing dependencies"
- apk add openssh-client git curl ansible
- echo "Configuring ssh"
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa; chmod 0600 ~/.ssh/id_rsa
- echo "StrictHostKeyChecking no " > /root/.ssh/config
- echo "Configuring git"
- git config --global http.sslVerify false
- git config --global user.email "$GITLAB_USER_EMAIL"
- git config --global user.name "GitLab CI/CD"
script:
- echo "Fetching all tags"
- git fetch --all --tags
- echo "Determining new release"
- NEW_RELEASE=$(grep "^version" galaxy.yml | cut -d " " -f 2)
- echo $NEW_RELEASE
- echo "Determining new release tag and message"
- NEW_RELEASE_TAG=$(echo "v"$NEW_RELEASE)
- echo $NEW_RELEASE_TAG
- NEW_RELEASE_MESSAGE=$(echo "Release "$NEW_RELEASE)
- echo $NEW_RELEASE_MESSAGE
- echo "Tagging new release"
- git remote set-url origin git@$CI_SERVER_HOST:$CI_PROJECT_PATH.git
- git tag -a $NEW_RELEASE_TAG -m "$NEW_RELEASE_MESSAGE" -m "[skip ci]"
- git push --tags --no-verify
- echo "Creating changelog"
- scripts/changelog.py > CHANGELOG.md
- echo "Creating artifact"
- ansible-galaxy collection build
- echo "Uploading artifact to Nexus"
- curl --verbose --user "${NEXUS_USER}:${NEXUS_PASSWORD}" --upload-file "itential-deployer-${NEW_RELEASE}.tar.gz" https://registry.aws.itential.com/repository/ansible-galaxy/
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- galaxy.yml
artifacts:
name: "$CI_PROJECT_NAME"
paths:
- "*.tar.gz"
expire_in: 90 days