-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
93 lines (89 loc) · 3.39 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
stages:
- build
- preview
- publish
container_build:
image: quay.io/podman/stable
stage: build
services:
- docker:dind
before_script:
- podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- podman build --pull -t $CI_REGISTRY_IMAGE/hugo_build:$CI_COMMIT_BRANCH -f hugo_dockerfile .
- podman tag $CI_REGISTRY_IMAGE/hugo_build:$CI_COMMIT_BRANCH $CI_REGISTRY_IMAGE/hugo_build:$CI_COMMIT_SHORT_SHA
- podman push $CI_REGISTRY_IMAGE/hugo_build:$CI_COMMIT_BRANCH
- podman push $CI_REGISTRY_IMAGE/hugo_build:$CI_COMMIT_SHORT_SHA
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop"
changes:
- hugo_dockerfile
when: on_success
allow_failure: true
# Give the option to run the job manually as needed
- when: manual
allow_failure: true
dev_container_build:
image: quay.io/podman/stable
stage: build
services:
- docker:dind
before_script:
- podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- podman build --pull -t $CI_REGISTRY_IMAGE/dev_ide:$CI_COMMIT_BRANCH -f dev-ide_dockerfile .
- podman tag $CI_REGISTRY_IMAGE/dev_ide:$CI_COMMIT_BRANCH $CI_REGISTRY_IMAGE/dev_ide:$CI_COMMIT_SHORT_SHA
- podman push $CI_REGISTRY_IMAGE/dev_ide:$CI_COMMIT_BRANCH
- podman push $CI_REGISTRY_IMAGE/dev_ide:$CI_COMMIT_SHORT_SHA
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop"
changes:
- dev-ide_dockerfile
when: on_success
allow_failure: true
# Give the option to run the job manually as needed
- when: manual
allow_failure: true
# This job builds the site when a merge request is accepted on the 'develop'
# branch and deploys it to the project's Google Firebase Preview Channel.
# It retrieves the temporary URL and assigns that to a GitLab Environment.
site_preview_deploy:
image: registry.gitlab.com/nkester/about-me-site/hugo_build:develop
stage: preview
rules:
- if: $CI_COMMIT_BRANCH == "develop"
allow_failure: true
# Give the option to run the job manually as needed
- if: $CI_COMMIT_BRANCH == "develop"
when: manual
allow_failure: true
script:
- hugo
- firebase hosting:channel:deploy develop --token "$FIREBASE_TOKEN" --expires 1h
- firebase hosting:channel:list --json --token "$FIREBASE_TOKEN" > channels.txt
- DYNAMIC_ENVIRONMENT_URL=$(python3 get_preview_url.py)
- echo "DYNAMIC_ENVIRONMENT_URL=$DYNAMIC_ENVIRONMENT_URL" >> deploy.env
artifacts:
reports:
dotenv: deploy.env
environment:
name: review/develop
url: $DYNAMIC_ENVIRONMENT_URL
# This job executes when a merge request is accepted to the 'main' branch
# It builds the site and deploys it to the project's Google Firebase 'deploy'
# or live channel.
site_deploy:
image: registry.gitlab.com/nkester/about-me-site/hugo_build:main
stage: publish
environment:
name: production
url: https://about.nkester.com
rules:
- if: $CI_COMMIT_BRANCH == "main"
# Give the option to run the job manually as needed
- if: $CI_COMMIT_BRANCH == "main"
when: manual
allow_failure: true
script:
- hugo
- firebase deploy --token "$FIREBASE_TOKEN"