]> git.r.bdr.sh - rbdr/r.bdr.sh/commitdiff
Autodeploy the page via CI
authorRuben Beltran del Rio <redacted>
Thu, 14 Oct 2021 21:47:52 +0000 (23:47 +0200)
committerRuben Beltran del Rio <redacted>
Thu, 14 Oct 2021 21:47:52 +0000 (23:47 +0200)
17 files changed:
.gitignore
.gitlab-ci.yml [new file with mode: 0644]
Dockerfile [new file with mode: 0644]
Gemfile
Gemfile.lock
Makefile [new file with mode: 0644]
_config.development.yml [new file with mode: 0644]
_config.production.yml [new file with mode: 0644]
_config.yml
docker-compose.yml [new file with mode: 0644]
env.dist [new file with mode: 0644]
jekyll/_layouts/default.html
jekyll/humans.txt
jekyll/index.html
jekyll/manifest.webmanifest
scripts/mime.types [new file with mode: 0644]
scripts/upload.sh [new file with mode: 0644]

index a8d48c6a5c84be39fbf690b794382c6bd7b9bc89..566151dba99992acab078f43413f454eb6ef6fa9 100644 (file)
@@ -4,3 +4,4 @@ log/*
 _site
 
 .jekyll-cache
+.env
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..9f2d010
--- /dev/null
@@ -0,0 +1,15 @@
+stages:
+  - upload
+
+upload:
+  stage: upload
+  except: main
+  script:
+    - make upload
+
+upload_production:
+  stage: upload
+  only: main
+  environment: production
+  script:
+    - make upload
diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..ee57d2e
--- /dev/null
@@ -0,0 +1,22 @@
+FROM ruby:3-alpine
+
+RUN apk add --no-cache \
+        build-base \
+        python3 \
+        py3-pip
+
+RUN pip3 install awscli
+RUN rm -rf /var/cache/apk/*
+
+RUN bundle config --global frozen 1
+
+WORKDIR /app
+
+COPY Gemfile.lock .
+COPY Gemfile .
+RUN bundle install
+
+COPY scripts/mime.types /etc/mime.types
+COPY . .
+
+ENTRYPOINT ["jekyll"]
diff --git a/Gemfile b/Gemfile
index b5bb5c17201c864b632720d6ddc77eb2b46aec61..d34419318aaf8ca066f904efa846d89823be0ece 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,6 @@
-source :rubygems
+source "https://rubygems.org"
 
 #Blog stuff
 gem 'jekyll'
 gem 'rdiscount'
+gem 'webrick'
index c625f663de53cbd9a9405f384bc1eaa3c67106a6..dacdb0d0f1e60b1cb06d6dfd1ad1c3243b4e491d 100644 (file)
@@ -1,69 +1,72 @@
 GEM
-  remote: http://rubygems.org/
+  remote: https://rubygems.org/
   specs:
-    addressable (2.7.0)
+    addressable (2.8.0)
       public_suffix (>= 2.0.2, < 5.0)
     colorator (1.1.0)
-    concurrent-ruby (1.1.7)
+    concurrent-ruby (1.1.9)
     em-websocket (0.5.2)
       eventmachine (>= 0.12.9)
       http_parser.rb (~> 0.6.0)
     eventmachine (1.2.7)
-    ffi (1.13.1)
+    ffi (1.15.4)
     forwardable-extended (2.6.0)
     http_parser.rb (0.6.0)
-    i18n (1.8.5)
+    i18n (1.8.10)
       concurrent-ruby (~> 1.0)
-    jekyll (4.1.1)
+    jekyll (4.2.1)
       addressable (~> 2.4)
       colorator (~> 1.0)
       em-websocket (~> 0.5)
       i18n (~> 1.0)
       jekyll-sass-converter (~> 2.0)
       jekyll-watch (~> 2.0)
-      kramdown (~> 2.1)
+      kramdown (~> 2.3)
       kramdown-parser-gfm (~> 1.0)
       liquid (~> 4.0)
       mercenary (~> 0.4.0)
       pathutil (~> 0.9)
       rouge (~> 3.0)
       safe_yaml (~> 1.0)
-      terminal-table (~> 1.8)
+      terminal-table (~> 2.0)
     jekyll-sass-converter (2.1.0)
       sassc (> 2.0.1, < 3.0)
     jekyll-watch (2.2.1)
       listen (~> 3.0)
-    kramdown (2.3.0)
+    kramdown (2.3.1)
       rexml
     kramdown-parser-gfm (1.1.0)
       kramdown (~> 2.0)
     liquid (4.0.3)
-    listen (3.2.1)
+    listen (3.7.0)
       rb-fsevent (~> 0.10, >= 0.10.3)
       rb-inotify (~> 0.9, >= 0.9.10)
     mercenary (0.4.0)
     pathutil (0.16.2)
       forwardable-extended (~> 2.6)
     public_suffix (4.0.6)
-    rb-fsevent (0.10.4)
+    rb-fsevent (0.11.0)
     rb-inotify (0.10.1)
       ffi (~> 1.0)
     rdiscount (2.2.0.2)
-    rexml (3.2.4)
-    rouge (3.24.0)
+    rexml (3.2.5)
+    rouge (3.26.1)
     safe_yaml (1.0.5)
     sassc (2.4.0)
       ffi (~> 1.9)
-    terminal-table (1.8.0)
+    terminal-table (2.0.0)
       unicode-display_width (~> 1.1, >= 1.1.1)
-    unicode-display_width (1.7.0)
+    unicode-display_width (1.8.0)
+    webrick (1.7.0)
 
 PLATFORMS
-  ruby
+  x86_64-darwin-21
+  x86_64-linux-musl
 
 DEPENDENCIES
   jekyll
   rdiscount
+  webrick
 
 BUNDLED WITH
-   2.1.2
+   2.2.22
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..ce038f4
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+repo_full_name = $(shell git remote -v | grep origin | grep push | grep -o '[^:/]\+\/[^/]\+\s\+' | grep -o '[^:]\+\/[^. ]\+'| tr '[:upper:]' '[:lower:]')
+git_sha = $(shell git rev-parse --short HEAD)
+
+environment = development
+
+default: preview
+
+serve: docker-build
+       docker-compose run unlimited.pizza serve --host 0.0.0.0 --config _config.yml,_config.$(environment).yml
+
+build: docker-build
+       docker-compose run unlimited.pizza build --config _config.yml,_config.$(environment).yml
+
+update-dependencies:
+       docker-compose run --entrypoint=bundle unlimited.pizza config --global frozen 0; bundle update
+
+docker-build:
+       docker-compose build
+
+upload: build
+       docker-compose run --entrypoint=/bin/sh unlimited.pizza ./scripts/upload.sh
diff --git a/_config.development.yml b/_config.development.yml
new file mode 100644 (file)
index 0000000..5d6fa5d
--- /dev/null
@@ -0,0 +1,2 @@
+domain: limited.pizza
+
diff --git a/_config.production.yml b/_config.production.yml
new file mode 100644 (file)
index 0000000..647b24a
--- /dev/null
@@ -0,0 +1 @@
+domain: unlimited.pizza
index 46787299bf04876063d5b3a7151625e031d8311b..1b3ca2a8327065735faf5288e4146f12dc6ec6b9 100644 (file)
@@ -1,6 +1,3 @@
 markdown: rdiscount
-permalink: /:year/:month/:day/:title
 exclude: ["Gemfile", "Gemfile.lock"]
 source: jekyll
-baseurl: "http://unlimited.pizza"
-baseurl: /
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..b4ae4c9
--- /dev/null
@@ -0,0 +1,11 @@
+version: '3.8'
+
+services:
+  unlimited.pizza:
+    build: .
+    env_file: .env
+    command: serve --host 0.0.0.0 --config _config.yml,_config.development.yml
+    volumes:
+      - .:/app
+    ports:
+      - '4000:4000'
diff --git a/env.dist b/env.dist
new file mode 100644 (file)
index 0000000..a5bab00
--- /dev/null
+++ b/env.dist
@@ -0,0 +1,3 @@
+S3_BUCKET=limited.pizza
+AWS_ACCESS_KEY_ID=
+AWS_SECRET_ACCESS_KEY=
index 52baf3596dbd1d85fdd8e6abf87a13962bbd5493..7fb45e043b08057a00c9467cecf0f221065c29bc 100644 (file)
@@ -9,10 +9,10 @@
 
     <title>Unlimited &#127829; {{ page.title }}</title>
 
-    <link rel="manifest" href="/manifest.webmanifest">
-    <link rel="stylesheet" type="text/css" href="/css/application.css">
+    <link rel="manifest" href="{{ baseurl }}manifest.webmanifest">
+    <link rel="stylesheet" type="text/css" href="{{ baseurl }}css/application.css">
 
-    <script type="module" src="/js/animation.js"></script>
+    <script type="module" src="{{ baseurl }}js/animation.js"></script>
 
     <!--
         /\
@@ -25,7 +25,7 @@
     <header>
       <h1>
         <canvas width=100 height=100></canvas>
-        <a href="/">unlimited.pizza</a>
+        <a href="{{ baseurl }}">unlimited.pizza</a>
       </h1>
     </header>
     {{ content }}
index a6f792344395f3a0f7175a96b5888d33154a9920..bdd5eb3e19a4c48a96f4ae7d5de684eacd798381 100644 (file)
@@ -1,6 +1,9 @@
+---
+title: humans.txt
+---
 /* TEAM */
 Maintainer: Rubén Beltrán del Río
-Site: https://unlimited.pizza
+Site: https://{{ site.domain }}
 Twitter: @pigeonfolk
 From: Berlin, Germany
 
index f0c8869110c4bc667d1e636d0d316bf2f110680a..d38511af021b736545fd81a4bd9efe5078ad08e6 100644 (file)
@@ -6,20 +6,20 @@ description: "unlimited.pizza - ruben beltran del río surfs the internet: progr
 <main>
   <p>The personal website of Rubén Beltrán del Río</p>
   <p>
-  → <a href="http://blog.unlimited.pizza">blog</a>.
+  → <a href="http://blog.{{ site.domain }}">blog</a>.
   </p>
   <h2>Apps</h2>
   <ul>
     <li>
       <p>
-        <a href="http://do.unlimited.pizza">do</a>:
+      <a href="http://do.{{ site.domain }}">do</a>:
         A task manager for iOS and MacOS that makes you write a journal entry when the task is done.
         (<a aria-label="See the source of do" href="https://gitlab.com/rbdr/do">source</a>)
       </p>
     </li>
     <li>
       <p>
-        <a href="http://map.unlimited.pizza">map</a>:
+      <a href="http://map.{{ site.domain }}">map</a>:
         A MacOS app that lets you create wardley maps using text.
         (<a aria-label="See the source of map" href="https://gitlab.com/rbdr/map">source</a>)
       </p>
@@ -95,7 +95,7 @@ description: "unlimited.pizza - ruben beltran del río surfs the internet: progr
   <ul>
     <li>
       <p>
-      <a href="https://corona.unlimited.pizza">Corona Regeln</a>
+      <a href="https://corona.{{ site.domain }}">Corona Regeln</a>
         <span>(2021)</span>:
         Up-to-date corona rules for Berlin. Refresh frequently.
         (<a aria-label="See the source of Corona Regeln" href="https://gitlab.com/rbdr/corona-regeln">source</a>)
@@ -103,7 +103,7 @@ description: "unlimited.pizza - ruben beltran del río surfs the internet: progr
     </li>
     <li>
       <p>
-        <a href="https://flower.unlimited.pizza">Flower</a>
+      <a href="https://flower.{{ site.domain }}">Flower</a>
         <span>(2018)</span>:
         <span aria-hidden="true">🌹🌸🌺💐🌼🌻🌷</span>
         draw a flower rotating a cube
@@ -128,7 +128,7 @@ description: "unlimited.pizza - ruben beltran del río surfs the internet: progr
     </li>
     <li>
       <p>
-        <a href="https://frames.unlimited.pizza">Frames</a>
+      <a href="https://frames.{{ site.domain }}">Frames</a>
         <span>(2017)</span>:
         🆒
       </p>
@@ -150,7 +150,7 @@ description: "unlimited.pizza - ruben beltran del río surfs the internet: progr
     </li>
     <li>
       <p>
-        <a href="https://lgtm.unlimited.pizza">LGTM</a>
+      <a href="https://lgtm.{{ site.domain }}">LGTM</a>
         <span>(2016)</span>:
         Looks Good To Me! 👍
         (<a aria-label="See the source of LGTM" href="https://gitlab.com/rbdr/lgtm">source</a>)
@@ -158,14 +158,14 @@ description: "unlimited.pizza - ruben beltran del río surfs the internet: progr
     </li>
     <li>
       <p>
-        <a href="https://heart.unlimited.pizza">Heart</a>
+      <a href="https://heart.{{ site.domain }}">Heart</a>
         <span>(2016)</span>:
         ❤️💜💙💛💚
       </p>
     </li>
     <li lang="es-MX">
       <p>
-        <a href="http://insultos.unlimited.pizza">Generador de Insultos</a>
+      <a href="http://insultos.{{ site.domain }}">Generador de Insultos</a>
         <span>(2015, Spanish)</span>:
         Un generador de insultos multi-usos que te da un insulto nuevo cada vez
         que lo cargas.
index fb582abd2e6dc94485ec688bda983ec8280d34c3..8c2ace033cd798acfd7d3c1e69016227a921001d 100644 (file)
@@ -1,7 +1,7 @@
 {
   "name": "Unlimited Pizza",
   "short_name": "Unlmtd 🍕",
-  "start_url": "/",
+  "start_url": "{{ baseurl }}",
   "display": "minimal-ui",
   "background_color": "#fff",
   "theme_color": "#fff",
diff --git a/scripts/mime.types b/scripts/mime.types
new file mode 100644 (file)
index 0000000..19eb627
--- /dev/null
@@ -0,0 +1,11 @@
+application/javascript js mjs cjs
+application/json json
+application/manifest+json webmanifest
+application/zip zip
+image/gif gif
+image/jpeg jpg jpeg
+image/png png
+image/vnd.microsoft.icon ico
+text/css css
+text/html html htm
+text/plain txt
diff --git a/scripts/upload.sh b/scripts/upload.sh
new file mode 100644 (file)
index 0000000..d1adaf6
--- /dev/null
@@ -0,0 +1,6 @@
+#!/usr/bin/env sh
+
+: "${S3_BUCKET:=limited.pizza}"
+
+echo "Uploading to $S3_BUCKET"
+aws s3 sync --acl public-read --delete _site s3://$S3_BUCKET