practicalli / blog-cryogen

Cryogen powered blog with all the content used to generate the static website.
https://practical.li/blog-cryogen/
3 stars 2 forks source link

Automate publishing of blog #102

Closed practicalli-johnny closed 3 years ago

practicalli-johnny commented 3 years ago

Use GitHub Actions to automatically publish the blog website when a pull request is merged or a commit is pushed to the live branch

practicalli-johnny commented 3 years ago

Create a GitHub action to build and publish the blog site to GitHub pages branch in the same repository

name: Publish Blog
on:
  push:
    branches:
    - live

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Prepare java
        uses: actions/setup-java@v2
        with:
          distribution: 'temurin'
          java-version: '11'

      - name: Install clojure tools
        uses: DeLaGuardo/setup-clojure@3.5
        with:
          cli: 1.10.3.855

      - name: Build Blog site
        run: clojure -M:build

      - name: Publish to GitHub Pages
        uses: JamesIves/github-pages-deploy-action@4.1.4
        with:
          token: ${{ secrets.PRACTICALLI_BLOG_PUBLISH_TOKEN }}  # -> remember add this in settings/secrets
          branch: gh-pages # The branch the action should deploy to.
          folder: public/blog # The folder the action should deploy.
          commit-message: ${{ github.event.head_commit.message }}
          single-commit: yes
practicalli-johnny commented 3 years ago

GitHub actions added in commit 83da87cf1eb3853fd0aeb90b918aba975b822435