Skip to content

Commit

Permalink
Merge pull request #25 from lamalex/cf-pages-ci-update
Browse files Browse the repository at this point in the history
update actions to use cf pages directly
  • Loading branch information
lamalex authored Jan 14, 2024
2 parents a226ee6 + e0c0f62 commit 293f652
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 53 deletions.
29 changes: 2 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,13 @@
name: GitHub Pages CI
on: [pull_request, push]
on: [push]

jobs:
verify:
runs-on: ubuntu-20.04
if: ${{ github.ref != 'refs/heads/master' }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Zola
run: sudo snap install --edge zola
- name: Verify build/links
run: zola check

build_and_deploy:
name: Build site with Zola and deploy
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs: verify
steps:
- uses: actions/checkout@master
- name: Install Zola
run: sudo snap install --edge zola
- name: Build PDF CV
run: |
zola serve &
export ZOLA_PID=$!
sleep 5
curl localhost:1111/cv &> /dev/null
google-chrome --headless --run-all-compositor-stages-before-draw --print-to-pdf-no-header --print-to-pdf=static/alexlauni-resume.pdf http://localhost:1111/cv
kill $ZOLA_PID
- name: Build site
run: zola build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy to Cloudflare Pages
on: [push]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Zola
run: sudo snap install --edge zola

- name: Build PDF CV
run: |
zola serve &
export ZOLA_PID=$!
sleep 5
curl localhost:1111/cv &> /dev/null
google-chrome \
--headless \
--disable-gpu \
--run-all-compositor-stages-before-draw \
--no-pdf-header-footer \
--print-to-pdf-no-header \
--print-to-pdf=static/alexlauni-resume.pdf \
http://localhost:1111/cv
kill $ZOLA_PID
- name: Print github.ref (debugging)
run: echo ${{ github.ref }}

- name: Set Build Command for Non-main Branch
if: contains(github.ref, 'refs/heads/') && !endsWith(github.ref, '/main')
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: echo "BUILD_COMMAND=zola build -u ${GITHUB_REF_NAME}.lamalex-github-io.pages.dev" >> $GITHUB_ENV

- name: Set Build Command for Main Branch
if: endsWith(github.ref, '/main')
run: echo "BUILD_COMMAND=zola build" >> $GITHUB_ENV

- name: Build site
run: ${{ env.BUILD_COMMAND }}

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: bde07ad246cac0ae6ae68324e6aae341
projectName: lamalex-github-io
directory: public
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
wranglerVersion: '3'
1 change: 0 additions & 1 deletion static/CNAME

This file was deleted.

Binary file removed static/images/scarlet.png
Binary file not shown.
4 changes: 2 additions & 2 deletions templates/cv-base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<head>
<meta charset="utf-8" />
<base target="_blank" />
<link rel="stylesheet" type="text/css" href="{{ get_url(path='cv.css') |safe }}" />
<link rel="stylesheet" type="text/css" href="/cv.css" />
<title>{% if content.title %} {{ content.title }} | {% endif %} CV</title>
</head>

Expand Down Expand Up @@ -42,4 +42,4 @@ <h1 data-heading="{{ content.title }}">
{% endblock content %}
</body>

{% endblock html %}
{% endblock html %}
16 changes: 8 additions & 8 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{% extends "site.html" %}
{% block content %}
<h1 class="Intro__heading h3">{{ section.title }}</h1>
<div class="Intro__byline h6">
{{ section.content | safe }}
</div>
<h1 class="Intro__heading h3">{{ section.title }}</h1>
<div class="Intro__byline h6">
{{ section.content | safe }}
</div>
{% endblock content %}

{% block script %}
<script defer="defer" src="{{ get_url(path="/scripts/photoswap.js") | safe}}" ></script>
<script defer="defer" src="/scripts/photoswap.js"></script>
{% endblock script %}

{% block flare %}
<img id="photo" src="{{ get_url(path="/images/selfparty.png") |safe }}" width="400px"
alt="A fine young person spreading Shaolin to the great people of Cadiz" />
{% endblock flare %}
<img id="photo" src="/images/selfparty.png" width="400px"
alt="A fine young person spreading Shaolin to the great people of Cadiz" />
{% endblock flare %}
27 changes: 12 additions & 15 deletions templates/site.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<meta property="og:url" content="{{ current_url }}" />
<meta name="twitter:creator" content="@rhonda_jeremy" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="{{ get_url(path="style.css") |safe }}" />
<link rel="stylesheet" type="text/css" href="/style.css" />

{% if section.extra.preloads %}
{% for preload in section.extra.preloads %}
<link rel="preload" as="image" href="{{ get_url(path=preload) }}" |safe }}" />
{% endfor %}
{% for preload in section.extra.preloads %}
<link rel="preload" as="image" href="{{ preload }}" />
{% endfor %}
{% endif %}
</head>

Expand All @@ -26,25 +26,22 @@
<nav class="nav">
<ul class="nav__list box-flex align-center md:space-before">
<li class="nav__item">
<a href="{{get_url(path="") |safe}}" aria-current="page" class="nav__item-hover"
data-id="blog">
<span class="nav__item-hover-inner" data-hover="blog">
<a href="/" aria-current="page" class="nav__item-hover" data-id="home">
<span class="nav__item-hover-inner" data-hover="home">
home
</span>
</a>
</li>
<li class="nav__item">
<a href="{{get_url(path="/blog/") }}" aria-current="page" class="nav__item-hover"
data-id="blog">
<a href="/blog" aria-current="page" class="nav__item-hover" data-id="blog">
<span class="nav__item-hover-inner" data-hover="blog">
blog
</span>
</a>
</li>
<li class="nav__item">
<a href="{{get_url(path="/cv") }}" aria-current="page" class="nav__item-hover"
data-id="cv">
<span class="nav__item-hover-inner" data-hover="blog">
<a href="/cv" aria-current=" page" class="nav__item-hover" data-id="cv">
<span class="nav__item-hover-inner" data-hover="cv">
cv
</span>
</a>
Expand Down Expand Up @@ -101,7 +98,7 @@
</div>
</div>
</main>
<script defer="defer" src="{{ get_url(path="/scripts/main.js") | safe}}"></script>
<script defer="defer" src="/scripts/main.js"></script>
{% block script %}{% endblock script %}
</body>
{% endblock html %}
{% endblock html %}

0 comments on commit 293f652

Please sign in to comment.