Skip to content

Commit

Permalink
Remove some redundancy in the github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
werthen committed Sep 27, 2024
1 parent 04c4502 commit e18c72c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 50 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build_site/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build the site
description: Build the site using nanoc

runs:
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodule
shell: bash
run: git submodule update --init --recursive --remote
- name: Cache install Nix packages
uses: rikhuijzer/cache-install@c90964bcac3286c8571cb849f7caffb9e8b9cb37
with:
key: nix-${{ hashFiles('packages.nix', 'gemset.nix') }}
nix_file: 'packages.nix'
- name: Cache Output
id: cache-output
uses: actions/cache@v4
with:
path: |
./tmp/
./output/
key: build-${{ github.ref_name }}
restore-keys: |
build-master
- name: Set environment variable
shell: bash
run: "export LANG=en_US.UTF-8"
- name: Build site
shell: bash
run: "bundle exec nanoc --env=prod"
- name: Run checks
shell: bash
run: "bundle exec nanoc --env=prod check --deploy"
26 changes: 1 addition & 25 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,7 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodule
run: git submodule update --init --recursive --remote
- name: Cache install Nix packages
uses: rikhuijzer/cache-install@c90964bcac3286c8571cb849f7caffb9e8b9cb37
with:
key: nix-${{ hashFiles('packages.nix', 'gemset.nix') }}
nix_file: 'packages.nix'
- name: Cache Output
id: cache-output
uses: actions/cache@v4
with:
path: |
./tmp/
./output/
key: build-${{ github.ref_name }}
restore-keys: |
build-master
- name: Set environment variable
run: "export LANG=en_US.UTF-8"
- name: Build site
run: "bundle exec nanoc --env=prod"
- name: Run checks
run: "bundle exec nanoc --env=prod check --deploy"
- uses: ./.github/actions/build_site
- name: Add private key
shell: bash
env:
Expand Down
26 changes: 1 addition & 25 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,7 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodule
run: git submodule update --init --recursive --remote
- name: Cache install Nix packages
uses: rikhuijzer/cache-install@c90964bcac3286c8571cb849f7caffb9e8b9cb37
with:
key: nix-${{ hashFiles('packages.nix', 'gemset.nix') }}
nix_file: 'packages.nix'
- name: Cache Output
id: cache-output
uses: actions/cache@v4
with:
path: |
./tmp/
./output/
key: build-${{ github.ref_name }}
restore-keys: |
build-master
- name: Set environment variable
run: "export LANG=en_US.UTF-8"
- name: Build site
run: "bundle exec nanoc --env=prod"
- name: Run checks
run: "bundle exec nanoc --env=prod check --deploy"
- uses: ./.github/actions/build_site
- name: Add private key
shell: bash
env:
Expand Down

0 comments on commit e18c72c

Please sign in to comment.