Skip to content

Commit

Permalink
Adds github workflows for building and publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
fekete-robert committed Oct 20, 2023
1 parent c2cd060 commit a4b39b7
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
submodules: 'recursive'

- name: Set up Hugo
uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d # v2.6.0
with:
hugo-version: '0.110.0'
extended: true

- name: Set up Node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 16

- name: Install dependencies
run: |
cd themes/docsy
npm install
- name: Set up PostCSS
run: npm install --save-dev autoprefixer postcss-cli postcss

- name: Build
run: hugo
74 changes: 74 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish

on:
push:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
submodules: 'recursive'

- name: Set up Pages
id: pages
uses: actions/configure-pages@f156874f8191504dae5b037505266ed5dda6c382 # v3.0.6

- name: Set up Hugo
uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d # v2.6.0
with:
hugo-version: '0.110.0'
extended: true

- name: Set up Node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 16

- name: Install dependencies
run: |
cd themes/docsy
npm install
- name: Set up PostCSS
run: npm install --save-dev autoprefixer postcss-cli postcss

- name: Build
run: hugo --environment production --baseURL ${{ steps.pages.outputs.base_url }}/

- name: Upload artifact
uses: actions/upload-pages-artifact@a753861a5debcf57bf8b404356158c8e1e33150c # v2.0.0
with:
path: ./public/

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@9dbe3824824f8a1377b8e298bafde1a50ede43e5 # v2.0.4

0 comments on commit a4b39b7

Please sign in to comment.