Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreytse committed Apr 1, 2024
1 parent b4edbc7 commit f121fd9
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 34 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/Gemfile.lock') }}
path: |
${{ github.workspace }}/.asdf/**
${{ github.workspace }}/vendor/bundle
key: ${{ runner.os }}-cache-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/cache.key') }}
restore-keys: |
${{ runner.os }}-gems-
${{ runner.os }}-cache-
- uses: ./
with:
provider: 'github'
Expand Down
65 changes: 39 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.1.9)
em-websocket (0.5.2)
concurrent-ruby (1.2.3)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.15.3)
ffi (1.16.3)
forwardable-extended (2.6.0)
gemoji (3.0.1)
http_parser.rb (0.6.0)
i18n (1.8.10)
http_parser.rb (0.8.0)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
jekyll (4.1.1)
addressable (~> 2.4)
Expand All @@ -30,55 +30,68 @@ GEM
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 1.8)
jekyll-feed (0.15.1)
jekyll-feed (0.17.0)
jekyll (>= 3.7, < 5.0)
jekyll-sass-converter (2.1.0)
jekyll-sass-converter (2.2.0)
sassc (> 2.0.1, < 3.0)
jekyll-seo-tag (2.7.1)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-spaceship (0.9.9)
jekyll-spaceship (0.10.2)
gemoji (~> 3.0)
jekyll (>= 3.6, < 5.0)
nokogiri (~> 1.6)
rainbow (~> 3.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.6.0)
liquid (4.0.4)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
mini_portile2 (2.8.5)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
nokogiri (1.16.3-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.3-arm-linux)
racc (~> 1.4)
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86-linux)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
public_suffix (5.0.4)
racc (1.7.3)
rainbow (3.0.0)
rb-fsevent (0.11.0)
rainbow (3.1.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (3.26.0)
rexml (3.2.6)
rouge (3.30.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.7.0)
unicode-display_width (1.8.0)

PLATFORMS
ruby
aarch64-linux
arm-linux
arm64-darwin
x86-linux
x86_64-darwin
x86_64-linux

DEPENDENCIES
jekyll (~> 4.1.0)
Expand All @@ -90,4 +103,4 @@ DEPENDENCIES
wdm (~> 0.1.1)

BUNDLED WITH
2.2.19
2.5.7
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ inputs:
cname:
description: 'The cname to use for the site'
required: false
ruby_ver:
description: 'The Ruby version'
required: false
bundler_ver:
description: 'The Bundler version'
required: false
Expand Down
7 changes: 6 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ SSH_PRIVATE_KEY=${INPUT_SSH_PRIVATE_KEY:=}
ACTOR=${INPUT_ACTOR}
REPOSITORY=${INPUT_REPOSITORY}
BRANCH=${INPUT_BRANCH}
BUNDLER_VER=${INPUT_BUNDLER_VER:=~>2.4.0}
RUBY_VER=${INPUT_RUBY_VER:=3.2.0}
BUNDLER_VER=${INPUT_BUNDLER_VER:=~>2.5.0}
JEKYLL_SRC=${INPUT_JEKYLL_SRC:=./}
JEKYLL_CFG=${INPUT_JEKYLL_CFG:=./_config.yml}
JEKYLL_BASEURL=${INPUT_JEKYLL_BASEURL:=}
Expand Down Expand Up @@ -149,4 +150,8 @@ if [[ -n "${SSH_PRIVATE_KEY}" ]]; then
rm -f ${SSH_PRIVATE_KEY_PATH}
fi

# Update cache key
echo "Update cache key..."
source ${SCRIPT_DIR}/script/update_cache_key.sh

exit ${PROVIDER_EXIT_CODE}
29 changes: 25 additions & 4 deletions script/init_environment.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

# Generate a default secret key
# To prevent archlinux-keyring from no secret key available to sign with
pacman-key --init

# Update packages database
pacman -Syu --noconfirm

Expand All @@ -11,11 +15,28 @@ if [[ -n "${SSH_PRIVATE_KEY}" ]]; then
pacman -S --noconfirm openssh
fi

# Installing ruby libraries
pacman -S --noconfirm ruby2.7 ruby-bundler
# Install asdf-vm
if [[ ! -f "${WORKING_DIR}/.asdf/asdf.sh" ]]; then
git clone https://github.com/asdf-vm/asdf.git \
${WORKING_DIR}/.asdf --branch v0.14.0
fi

# Fix invalid cache to asdf tools' installation
ln -s ${WORKING_DIR}/.asdf ${HOME}/.asdf

source ${HOME}/.asdf/asdf.sh

# Install ruby environment
pacman -S --noconfirm libyaml

if ! asdf list ruby ${RUBY_VER} &>/dev/null; then
# Clean up ruby environments avoiding unnecessary cache
rm -rf ${WORKING_DIR}/.asdf/installs/ruby
asdf plugin add ruby
asdf install ruby ${RUBY_VER}
fi

# Setting default ruby version
cp /usr/bin/ruby-2.7 /usr/bin/ruby
asdf global ruby ${RUBY_VER}

# debug
ruby -v && bundle version
Expand Down
14 changes: 14 additions & 0 deletions script/update_cache_key.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

CACHE_KEY_PATH=$HOME/cache.key

function sha1sumx() {
if [[ -f "$1" ]]; then
echo $(sha1sum "$1")>> $CACHE_KEY_PATH
fi
}

sha1sumx $(find "${WORKING_DIR}" -iname '**Gemfile.lock')
sha1sumx ${HOME}/.tool-versions

cat $CACHE_KEY_PATH

0 comments on commit f121fd9

Please sign in to comment.