From fde72515c6edebddadeea6622d466ca82d133778 Mon Sep 17 00:00:00 2001 From: Rantaharju Jarno Date: Mon, 27 May 2024 14:30:30 +0300 Subject: [PATCH] Zola workflow and skeleton --- .github/workflows/build.yml | 75 ++++++++++++++++++++++++++++++++ content/_index.md | 5 +++ templates/index.html | 85 +++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 content/_index.md create mode 100644 templates/index.html diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..28b4ba0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,75 @@ +# Zola build workflow. + +# Prerequisites: +# - zola writes output to public/ +# - variables below set correctly +# +# Setting it up: +# It is a general limitation of gh-actions that they cannot make the very first +# deploy to gh-pages. It will seem to work, but not appear on the CDN to be +# online. You need to go to settings and set the gh-pages branch, then future +# deploys will work. See +# https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-first-deployment-with-github_token + +name: Build/deploy website + +env: + ZOLA_VERSION: "0.17.2" + MAIN_BRANCH: "main" + TARGET_BRANCH: "gh-pages" + CNAME: "nordic-rse.org" + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository and submodules + uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install zola + run: | + set -x + wget -O - \ + "https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz" \ + | sudo tar xzf - -C /usr/local/bin + - name: Generate HTML + run: zola build + # Add CNAME, either (first one used) + # - file in the root + # - the environment variable set above + - name: add CNAME + if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', env.MAIN_BRANCH) }} + run: | + if [ -f CNAME ] ; then + mv CNAME public/ + echo "Copied CNAME from repository root" + exit 0 + fi + if [ -n ${{ env.CNAME }} ] ; then + echo -n ${{ env.CNAME }} > public/CNAME + echo "Used CNAME from the action workflow file" + fi + - name: Deploy to gh-pages + if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', env.MAIN_BRANCH) }} + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + force_orphan: true + - name: Deploy PR preview + if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this build is a PR build and the PR is NOT from a fork + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: ./public + TARGET_FOLDER: "previews/PR${{ github.event.number }}" # The website preview is going to be stored in the previews subfolder \ No newline at end of file diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..99b5576 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,5 @@ ++++ ++++ + +# Nordic RSE 2025 Conference + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..235e0e0 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,85 @@ + + + + + + + + + + + {% if page.title %}{{page.title}} - {% elif section.title %}{{ section.title }} - {% endif %}{{ config.title }} + + + + + + + + + + + {% block extracss %} + {% endblock extracss %} + + + + +
+ {% block content %} + {% endblock content %} +
+ + + + + {% block extrajs %} + {% endblock extrajs %} + + + + + + + + + + + \ No newline at end of file