6 Commits

5 changed files with 82 additions and 62 deletions

View File

@@ -1,14 +1,7 @@
FROM jekyll/minimal:latest # This image is cached on the Github Actions VM, so it drastically reduces build time
LABEL version="1.2.0" FROM jekyll/builder:latest
LABEL description="Minimal Jekyll image with basic build tools."
LABEL maintainer="Vivien Richter <vivien-richter@outlook.de>"
# Requirements
USER root USER root
RUN apk --no-cache add build-base
EXPOSE 4000/tcp
# Entry point
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Jerry van Leeuwen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,44 +1,46 @@
# Jekyll action # jekyll-build-action
[![License](https://img.shields.io/badge/%E2%9A%96%EF%B8%8F-CC%20BY%204.0-brightgreen)](https://creativecommons.org/licenses/by/4.0) Plain in-place Jekyll build action to be used in pipelines with a variety of possible deploy targets.
This action provides just Jekyll and some basic build tools ([Alpine's `build-base`](https://pkgs.alpinelinux.org/package/v3.3/main/x86/build-base)). # Usage
It's based on the [jekyll/minimal:latest](https://github.com/envygeeks/jekyll-docker) [Docker](https://docker.com) image and the [jerryjvl/jekyll-build-action](https://github.com/jerryjvl/jekyll-build-action). This Action literally only invokes a Jekyll build, so your pipeline needs to ensure the Jekyll source is first gathered, and once this action completes you must copy the contents of the destination folder to your intended hosting location.
## Usage A typical example would be a GitHub repository with Jekyll source, and publishing the output to an S3 bucket configured for static site hosting.
The pipeline to realize this would look something like the following:
```yaml ```yaml
jobs: jobs:
jekyll: jekyll:
name: Build and store Jekyll site name: Build and deploy Jekyll site
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout 📥 - name: Checkout
uses: actions/checkout@v2.3.4 uses: actions/checkout@v2
with:
lfs: true
fetch-depth: 1
- name: Build ⚙️ - name: Build
uses: vivi90/jekyll-minimal-action@v1.1.0 uses: jerryjvl/jekyll-build-action@v1
with:
command: jekyll build
- name: Store 📦 - name: Configure AWS credentials
uses: actions/upload-artifact@v2.2.4 uses: aws-actions/configure-aws-credentials@v1
if: success()
with: with:
name: site aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
path: _site aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Sync output to S3
run: |
aws s3 sync ./_site/ s3://my-s3-bucket --delete
``` ```
Just use the `command` option as you like:
- `jekyll build --trace`
- `jekyll serve`
- and so on..
## Contribution # References
Please feel free to create issues and/or pull requests. For more technical details on these steps and associated setup, see:
- [actions/checkout](https://github.com/actions/checkout)
- [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials)
- [Creating encrypted secrets in GitHub](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)
## License # A Note on Security
This project is free software under the terms of the CC BY 4.0 license. Please be mindful of the third-party actions you trust with your secrets, credentials and content. Without investigation you should assume a third-party action might exfiltrate your content to some secondary location, or modify contents before they are published.
For more details please see the LICENSE file or: [Creative Commons](http://creativecommons.org/licenses/by/4.0)
*The licenses of the installed components may differ.* Futhermore, if you rely on versioning that the publisher of an action can control, the action you think you are running could be changed later without your knowledge.
... Trust but verify!

View File

@@ -1,16 +1,8 @@
name: 'Jekyll Minimal Action' name: 'Build Jekyll'
author: 'Vivien Richter <vivien-richter@outlook.de>' description: 'Local pipeline build of Jekyll content; follow-on actions must publish it somewhere'
description: 'Pure minimal Jekyll pipeline with basic build tools for universal usage.'
inputs:
command:
description: 'Complete Jekyll command'
required: true
default: 'jekyll --help'
runs: runs:
using: 'docker' using: 'docker'
image: 'Dockerfile' image: 'Dockerfile'
args:
- ${{ inputs.command }}
branding: branding:
icon: 'book-open' icon: 'book-open'
color: 'red' color: 'white'

View File

@@ -1,16 +1,28 @@
#!/bin/sh #!/bin/sh
# Set verbose mode set -x # verbose mode
set -x set -e # stop executing after error
# Stop executing after error echo "Starting Jekyll build"
set -e
# Change permissions ####################################################
chmod -R a+w /github/workspace # Set workspace permissions
####################################################
# Use working directory pwd
cd /github/workspace
# Run command ls -R
$*
chmod -R a+w ./
####################################################
# Build the Jekyll site
####################################################
jekyll build --trace
####################################################
# Build completed
####################################################
echo "Completed Jekll build"