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

Allow override of bundler version or resolve from lock file #114

Merged
merged 42 commits into from
Jul 3, 2022
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4208abd
Allow override of bundler version
inverse Jan 21, 2022
b9f6ff9
Set in cfg
inverse Jan 21, 2022
cf0e5a7
debug
inverse Jan 21, 2022
63e91f4
Merge branch 'master' into override-bundler
inverse Jan 26, 2022
c655f0f
Fix typo
inverse Jan 27, 2022
65390a6
Remove debug line
inverse Jan 27, 2022
3e31504
change location
inverse Jan 28, 2022
25c84af
Resolve from Gemfile.lock
inverse Jan 28, 2022
2806145
Docs
inverse Jan 28, 2022
530341a
Fix for alpine grep
inverse Jan 28, 2022
a9b8937
Fix up
inverse Jan 28, 2022
c9a90d4
Add test
inverse Apr 19, 2022
29f6381
Test
inverse Apr 19, 2022
f62c109
Assert
inverse Apr 19, 2022
d1f6701
Add lock test
inverse Apr 19, 2022
f9592bc
Fix up
inverse Apr 19, 2022
09ff41f
Fix set-output
inverse Apr 19, 2022
85dd3c1
Update .github/workflows/test.yml
inverse Apr 30, 2022
1aa8539
Update .github/workflows/test.yml
inverse Apr 30, 2022
ba6fded
Update .github/workflows/test.yml
inverse Apr 30, 2022
e7e4b8e
Update .github/workflows/test.yml
inverse Apr 30, 2022
9780fb7
Update .github/workflows/test.yml
inverse Apr 30, 2022
f360e7a
Update .github/workflows/test.yml
inverse Apr 30, 2022
27ee4b6
Update .github/workflows/test.yml
inverse Apr 30, 2022
46701b1
Update .github/workflows/test.yml
inverse Apr 30, 2022
2174683
Update .github/workflows/test.yml
inverse Apr 30, 2022
e5e57a8
Fix typo
inverse Apr 30, 2022
8105a03
Update .github/workflows/test.yml
inverse Apr 30, 2022
5a5368c
Additional
inverse Apr 30, 2022
cf56a63
fi
inverse Apr 30, 2022
8067fd1
Simplify
inverse Apr 30, 2022
492dad3
Param change
inverse Apr 30, 2022
bf2fecb
Merge branch 'master' into override-bundler
inverse Apr 30, 2022
7074a90
Add missing configs
inverse May 1, 2022
58c84ca
Fix specs
inverse May 1, 2022
d304d95
Update .github/workflows/test.yml
inverse May 2, 2022
a0546ff
Fix tests
inverse May 2, 2022
a90140f
Move tests to proper solution
inverse May 3, 2022
614197e
Update .github/workflows/test.yml
inverse May 9, 2022
a19bd1c
Update .github/workflows/test.yml
inverse May 9, 2022
4692b50
Fix graph
inverse May 9, 2022
b6f1f96
remove lock file from bundler test and use bundle in site plugin
helaili Jul 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 112 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Testing the GitHub Pages publication

on:
push
push:
branches: [master]
pull_request:

concurrency: test_environment

Expand Down Expand Up @@ -69,6 +71,115 @@ jobs:
spec: cypress/integration/basic/**/*
suffix: "basic"

jekyll_bundler_run:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.run.outputs.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
restore-keys: |
gems
- name: Jekyll bundler run
id: run
uses: ./
with:
jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_jekyll_bundler.yml"
jekyll_src: sample_site
target_branch: jekyll_bundler_test_pages_branch
jekyll_env: production
bundler_version: 2.3.11
github-token: ${{secrets.JEKYLL_PAT}}
inverse marked this conversation as resolved.
Show resolved Hide resolved
env:
JEKYLL_DEBUG: true
- id: extract-bundler-version
run: echo ::set-output name=value::$(bundler -v | cut -c 16- | xargs)
- uses: nick-fields/assert-action@v1
with:
expected: 2.3.11
actual: ${{ steps.extract-bundler-version.outputs.value }}
comparison: exact
inverse marked this conversation as resolved.
Show resolved Hide resolved

jekyll_bundler_publish:
runs-on: ubuntu-latest
needs: [basic_test, jekyll_bundler_run]
inverse marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
sha: ${{ needs.jekyll_bundler_run.outputs.sha }}
branch: "jekyll_bundler_test_pages_branch"
path: "/"

jekyll_bundler_test:
runs-on: ubuntu-latest
needs: jekyll_bundler_publish
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
spec: cypress/integration/jekyll_bundler/**/*
suffix: "jekyll_bundler"

jekyll_bundler_from_lock_run:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.run.outputs.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
restore-keys: |
gems
- name: Jekyll bundler lock run
id: run
uses: ./
with:
jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_jekyll_bundler_lock.yml"
jekyll_src: sample_site
target_branch: jekyll_bundler_lock_test_pages_branch
jekyll_env: production
token: ${{ secrets.GITHUB_TOKEN }}
env:
JEKYLL_DEBUG: true
- id: extract-bundler-version
run: echo ::set-output name=value::$(bundler -v | cut -c 16- | xargs)
- uses: nick-fields/assert-action@v1
with:
expected: 2.1.4
actual: ${{ steps.extract-bundler-version.outputs.value }}
comparison: exact

jekyll_bundler_from_lock_publish:
runs-on: ubuntu-latest
needs: [basic_test, jekyll_bundler_from_lock_run]
inverse marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
sha: ${{ needs.jekyll_bundler_from_lock_run.outputs.sha }}
branch: "jekyll_bundler_lock_test_pages_branch"
path: "/"

jekyll_bundler_from_lock_test:
runs-on: ubuntu-latest
needs: jekyll_bundler_publish
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
spec: cypress/integration/jekyll_bundler_lock/**/*
suffix: "jekyll_bundler_lock"

jekyll_src_run:
runs-on: ubuntu-latest
outputs:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ When set to `true`, previous version of the site will be restored before the Jek
keep_files: [.git, hello.html]
```

### bundler_version
When set override the default bundler version provided. If not given will attempt to resolve bundler version from `Gemfile.lock` if one exists.

## Use case: multi version publishing

Say you want to create a documentation website where you both have the current version (`v3.0`), but also `v1.0` and `v2.0`. You can then use a combination of `keep_history` and `target_path` along with the `actions/checkout@v2`action so that each version gets pushed in a separate folder without overwritting the previous one.
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ inputs:
new dependencies. For example, use `apk --update add
imagemagick` to install ImageMagick.
required: false
bundler_version:
description: 'When set override the default bundler version provided.'
required: false
outputs:
sha:
description: 'Generated commit SHA1 that will be published'
Expand Down
12 changes: 12 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ set -e

echo "Starting the Jekyll Action"

if [ -n "${INPUT_BUNDLER_VERSION}" ]; then
echo "Installing bundler version specified by the user."
gem install bundler -v ${INPUT_BUNDLER_VERSION}
fi

if [ -n "$INPUT_PRE_BUILD_COMMANDS" ]; then
echo "Execute pre-build commands specified by the user."
eval "$INPUT_PRE_BUILD_COMMANDS"
Expand Down Expand Up @@ -121,6 +126,13 @@ echo "::debug::Local branch is ${LOCAL_BRANCH}"

cd "${GITHUB_WORKSPACE}/${GEM_SRC}"

if [ -z "${INPUT_BUNDLER_VERSION}" ] && [ -f "Gemfile.lock" ]; then
echo "Resolving bundler version from Gemfile.lock"
VERSION_LINE_NUMBER=$(($(cat Gemfile.lock | grep -n 'BUNDLED WITH' | grep -oE '\d+')+1))
BUNDLER_VERSION=$(head -n ${VERSION_LINE_NUMBER} Gemfile.lock | tail -n 1 | xargs)
gem install bundler -v ${BUNDLER_VERSION}
fi

bundle config path "$PWD/vendor/bundle"
echo "::debug::Bundle config set succesfully"
bundle install
Expand Down
2 changes: 2 additions & 0 deletions sample_site/_config_jekyll_bundler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
title: Jekyll AsciiDoc Action - Jekyll Bundler
test_id: jekyll_bundler
2 changes: 2 additions & 0 deletions sample_site/_config_jekyll_bundler_lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
title: Jekyll AsciiDoc Action - Jekyll Bundler Lock
test_id: jekyll_bundler_lock
6 changes: 6 additions & 0 deletions tests/e2e/cypress/integration/jekyll_bundler/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
it('works', () => {
cy.visit('/jekyll-action/')
cy.get('#jekyll_bundler').should('be.visible')
cy.get('body main div header h1').should('contain', 'Jekyll AsciiDoc Action - Jekyll Bundler')
cy.get('#env').should('contain', 'production')
})
6 changes: 6 additions & 0 deletions tests/e2e/cypress/integration/jekyll_bundler_lock/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
it('works', () => {
cy.visit('/jekyll-action/')
cy.get('#jekyll_bundler_lock').should('be.visible')
cy.get('body main div header h1').should('contain', 'Jekyll AsciiDoc Action - Jekyll Bundler Lock')
cy.get('#env').should('contain', 'production')
})