diff --git a/action.yml b/action.yml index cdffc00..79d986e 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 352ab20..19768dc 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.0.6-1} +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 410a61c..142633f 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,27 @@ if [[ -n "${SSH_PRIVATE_KEY}" ]]; then pacman -S --noconfirm openssh fi + # Installing ruby libraries -pacman -S --noconfirm ruby2.7 ruby-bundler +case "${RUBY_VERSION}" in + 2.7) + pacman -S --noconfirm ruby2.7 + + # Setting default ruby version + cp /usr/bin/ruby-2.7 /usr/bin/ruby + ;; + 3*) + # https://gitlab.archlinux.org/archlinux/packaging/packages/ruby/-/tags + pacman -S --noconfirm ruby-${RUBY_VERSION} + + # Fix warning: You don't have ./ruby/3.0.0/bin in your PATH, + # gem executables will not run + export GEM_HOME="$(ruby -e 'puts Gem.user_dir')" + export PATH="$PATH:$GEM_HOME/bin" + ;; +esac -# Setting default ruby version -cp /usr/bin/ruby-2.7 /usr/bin/ruby +pacman -S --noconfirm ruby-bundler # debug ruby -v && bundle version