Unverified Commit 824db100 authored by Tomáš Zemanovič's avatar Tomáš Zemanovič
Browse files

migration to gitlab

parent b704bbc6
Pipeline #23371555 canceled with stage
in 11 minutes and 45 seconds
title: Migration to GitLab
tags: blog, github, gitlab, microsoft, continuous delivery, easy
published: 2018-06-06
For no reason in particular at all :), I moved my website over to GitLab pages from GitHub pages. On the way, I got a pleasant surprise with the integrated CI/CD, which made it really easy to replace my [release script](https://github.com/tzemanovic/tzemanovic/blob/2f55be06722f1e13a030d02a988a1d9abcc5b287/src/publish.sh) that simply pushed built project into another repository that was hosting the page with [a job configuration that handles build and release in the same repository](https://gitlab.com/tzemanovic/tzemanovic.gitlab.io/blob/master/.gitlab-ci.yml), nice and easy.
set -e
stack exec site build
# Create _publish directory if it doesn't exits
mkdir -p _publish
cd _publish
# Clone the giuthub page repo or pull the latest version
if [ ! -d "tzemanovic.github.io" ]; then
git clone https://github.com/tzemanovic/tzemanovic.github.io.git
git pull origin master
cd tzemanovic.github.io
# Prepend the file names you want to keep in here with dot
# Clean up
rm -rf *
# Undo the name changes
# Hakyll by default generates site into _site directory
cp -rf ../../_site/* .
# Add all files to git
git add --all :/
git add -u :/
echo -n "enter commit message: "
read -e msg
git commit -m "$msg"
# If you are using cygwin, git push command will get stuck, so use the following command first to cofigure git to ask for password in a popup window
# git config --global core.askpass "git-gui--askpass"
git push origin master
# Publish the source code too
cd ../..
git add --all :/
git add -u :/
git commit -m "$msg"
git push origin master
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment