Skip to content

Commit

Permalink
Update GH Actions workflow related to deployment
Browse files Browse the repository at this point in the history
The action helaili/jekyll-action is deprecated
and the repository has been archived. [1]

I described the use of `helaili/jekyll-action` GitHub Actions
in a blog post. [2]

However, I intend to update this post with the current changes.

> This repository has been archived by the owner on Jun 13, 2023.
> It is now read-only.

This is due to changes introduced by GitHub.

> GitHub has a new way to publish a static site
> to Pages using GitHub Actions.
> This means you can now build with the Jekyll command
> (or something else) and use actions to publish,
> all using regular steps.
> This removes the need for Docker based actions
> and gives you all the freedom to configure the execution environment
> (versions of Ruby, extra dependencies...),
> it is a lot faster, easier to debug and closer
> to what you can run on your local machine.

Therefore, the process now takes place in two stages: build & deploy.

The action will be triggered when the default branch is changed
or when invoked manually.

[1]: https://github.com/helaili/jekyll-action
[2]: https://torrocus.com/blog/deployment-jekyll-using-github-actions/
  • Loading branch information
torrocus committed Oct 15, 2023
1 parent 5e71849 commit 7d98280
Showing 1 changed file with 49 additions and 15 deletions.
64 changes: 49 additions & 15 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,58 @@
name: deployment

on:
# Runs on pushes targeting the default branch
push:
branches:
- master
branches: [$default-branch]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
id-token: write
pages: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress
# and latest queued. However, do NOT cancel in-progress runs as we want to allow
# these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
github-pages:
# Build job
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
with:
enablement: true
- name: Build with Jekyll
env:
JEKYLL_ENV: production
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
- name: Upload artifact
uses: actions/upload-pages-artifact@v2

- uses: helaili/[email protected]
env:
JEKYLL_ENV: production
JEKYLL_PAT: ${{ secrets.JEKYLL_PAT }}
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit 7d98280

Please sign in to comment.