Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2024-website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUDE
2024-website
Commits
f0bd8d84
Commit
f0bd8d84
authored
6 months ago
by
Robert Lanzafame
Browse files
Options
Downloads
Plain Diff
Merge branch 'revert-
0d58cc48
' into 'main'
Revert "Update .gitlab-ci.yml file" See merge request
!5
parents
0d58cc48
4c552027
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!10
merge for publish
,
!5
Revert "Update .gitlab-ci.yml file"
Pipeline
#245690
passed
6 months ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+31
-40
31 additions, 40 deletions
.gitlab-ci.yml
with
31 additions
and
40 deletions
.gitlab-ci.yml
+
31
−
40
View file @
f0bd8d84
image
:
python:3.10-bullseye
image
:
ruby:3.2.2-bookworm
stages
:
-
build
-
deploy
variables
:
PIP_CACHE_DIR
:
"
$CI_PROJECT_DIR/.cache/pip"
LC_ALL
:
C.UTF-8
cache
:
paths
:
-
.cache/pip
-
venv/
before_script
:
-
python -V
-
pip install virtualenv
-
virtualenv venv
-
source venv/bin/activate
-
pip install -r requirements.txt
-
apt-get update && apt-get install -y jq
# Install jq
build-book
:
build-page
:
stage
:
build
variables
:
JEKYLL_ENV
:
${{ CI_COMMIT_BRANCH == "publish" && "production" || "development" }}
before_script
:
-
gem install bundler
-
bundle install
-
chmod +x ./build-page.sh
script
:
-
|
if [ "$CI_COMMIT_BRANCH" == "publish" ]; then
echo "Building production version"
teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
echo "Running on publish branch"
./build-page.sh "/" true
elif [ "$CI_COMMIT_BRANCH" == "main" ]; then
echo "Running on main branch"
./build-page.sh "/2024/draft" false
else
echo "
Building draft version
"
teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
echo "
Running on other branches
"
./build-page.sh "/draft" false
fi
artifacts
:
paths
:
-
book/_build/html
-
stdout.log
-
stderr.log
expire_in
:
1 week
-
public
rules
:
-
if
:
$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish"
-
if
:
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish"
...
...
@@ -44,46 +37,44 @@ build-book:
deploy-draft
:
stage
:
deploy
needs
:
[
"
build-
book
"
]
needs
:
[
"
build-
page
"
]
script
:
-
|
BUILD_JOB_ID=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success" | jq '.[] | select(.name=="build-book") | .id')
curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \
curl -X POST https://mude.citg.tudelft.nl/hooks/website-deploy-draft \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-
m4CzsDqHnXNn3Pf5Whyd
" \
-H "X-Gitlab-Token: glpat-
sQ82fiSMo1kCi2TpgSfr
" \
-d '{
"object_kind": "pipeline",
"object_attributes": {
"status": "success",
"ref": "main"
},
"build_job_id": "'$BUILD_JOB_ID'"
}
}'
environment
:
name
:
draft
url
:
https://mude.citg.tudelft.nl/2024/
book/
draft
url
:
https://mude.citg.tudelft.nl/2024/draft
rules
:
-
if
:
$CI_COMMIT_BRANCH == "main"
-
if
:
$CI_COMMIT_BRANCH == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"
when
:
always
deploy-production
:
stage
:
deploy
needs
:
[
"
build-
book
"
]
needs
:
[
"
build-
page
"
]
script
:
-
|
BUILD_JOB_ID=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success" | jq '.[] | select(.name=="build-book") | .id')
curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \
curl -X POST https://mude.citg.tudelft.nl/hooks/website-deploy \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-
m4CzsDqHnXNn3Pf5Whyd
" \
-H "X-Gitlab-Token: glpat-
sQ82fiSMo1kCi2TpgSfr
" \
-d '{
"object_kind": "pipeline",
"object_attributes": {
"status": "success",
"ref": "publish"
},
"build_job_id": "'$BUILD_JOB_ID'"
}
}'
environment
:
name
:
production
url
:
https://mude.citg.tudelft.nl/2024
/book
url
:
https://mude.citg.tudelft.nl/2024
rules
:
-
if
:
$CI_COMMIT_BRANCH == "publish"
\ No newline at end of file
-
if
:
$CI_COMMIT_BRANCH == "publish" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish"
when
:
always
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment