From 6f294d07f1f32afd756b29a4e65b0c317f0c2679 Mon Sep 17 00:00:00 2001 From: Jeffrey Tse Date: Fri, 29 Mar 2024 09:55:23 +0800 Subject: [PATCH] test --- .github/workflows/deploy-test.yml | 8 ++-- Gemfile.lock | 65 ++++++++++++++++++------------- action.yml | 3 ++ entrypoint.sh | 3 +- script/init_environment.sh | 30 ++++++++++++-- 5 files changed, 75 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml index c0db5282..2d1801b1 100644 --- a/.github/workflows/deploy-test.yml +++ b/.github/workflows/deploy-test.yml @@ -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('${{ github.workspace }}/.asdf/installs/**') }}-${{ hashFiles('**/Gemfile.lock') }} restore-keys: | - ${{ runner.os }}-gems- + ${{ runner.os }}-cache- - uses: ./ with: provider: 'github' diff --git a/Gemfile.lock b/Gemfile.lock index 152682b4..9f8e3c6d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -90,4 +103,4 @@ DEPENDENCIES wdm (~> 0.1.1) BUNDLED WITH - 2.2.19 + 2.5.7 diff --git a/action.yml b/action.yml index cdffc007..79d986e6 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index 352ab207..c35e67f6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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:=} diff --git a/script/init_environment.sh b/script/init_environment.sh index 410a61c6..70fdffd6 100755 --- a/script/init_environment.sh +++ b/script/init_environment.sh @@ -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 @@ -11,11 +15,29 @@ 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 +realpath ${HOME} +ls -la ${HOME}/.asdf + +# Install Ruby environment +if ! asdf list ruby ${RUBY_VER} &>/dev/null; then + pacman -S --noconfirm libyaml + asdf plugin add ruby + asdf install ruby ${RUBY_VER} +fi + +asdf global ruby ${RUBY_VER} -# Setting default ruby version -cp /usr/bin/ruby-2.7 /usr/bin/ruby +ls -la ${HOME} # debug ruby -v && bundle version