Install Node.js 16 and 18 by default (and 20 additionally) (#98)

* Install Node.js 16 and 18 by default (and 20 additionally)

* Use caching for go test
This commit is contained in:
Rene Leonhardt
2023-07-27 14:31:50 +02:00
committed by GitHub
parent 311d8fff18
commit 284416fdf8
6 changed files with 11 additions and 10 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ env:
IMAGE_LABEL_REPO: ${{ github.repository }}
SLUG: ${{ github.repository_owner }}/ubuntu
DISTRO: ubuntu
NODE: '16'
NODE: '16 18'
BUILD_REF: ${{ github.sha }}
SKIP_TEST: false
@@ -141,7 +141,7 @@ jobs:
)
- if: ${{ !env.SKIP_TEST }}
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: '^1.16'
+1 -1
View File
@@ -28,7 +28,7 @@
- `ghcr.io/catthehacker/ubuntu:runner-20.04`
- `ghcr.io/catthehacker/ubuntu:runner-22.04`
- `ghcr.io/catthehacker/ubuntu:runner-latest`
- [`/linux/ubuntu/js`](./linux/ubuntu/scripts/js.sh) - `ghcr.io/catthehacker/ubuntu:act-*` but with `js` tools installed (`yarn`, `nvm`, `node` v10/v12, `pnpm`, `grunt`, etc.)
- [`/linux/ubuntu/js`](./linux/ubuntu/scripts/js.sh) - `ghcr.io/catthehacker/ubuntu:act-*` but with `js` tools installed (`yarn`, `nvm`, `node` v16/v18, `pnpm`, `grunt`, etc.)
- `ghcr.io/catthehacker/ubuntu:js-20.04`
- `ghcr.io/catthehacker/ubuntu:js-22.04`
- `ghcr.io/catthehacker/ubuntu:js-latest`
+2 -1
View File
@@ -10,7 +10,8 @@ ARG FROM_IMAGE
ARG FROM_TAG
# > Our custom ARGs
ARG NODE_VERSION="12 16"
# latest Node.js LTS versions
ARG NODE_VERSION="16 18"
ARG DISTRO=ubuntu
ARG TYPE=act
ARG RUNNER
+1 -1
View File
@@ -121,7 +121,7 @@ for ver in "${NODE[@]}"; do
wget "https://nodejs.org/download/release/latest-v${ver}.x/node-$VER-linux-$(node_arch).tar.xz" -O "node-$VER-linux-$(node_arch).tar.xz"
tar -Jxf "node-$VER-linux-$(node_arch).tar.xz" --strip-components=1 -C "$NODEPATH"
rm "node-$VER-linux-$(node_arch).tar.xz"
if [[ "${ver}" == "16" ]]; then
if [[ "${ver}" == "18" ]]; then # make this version the default (latest LTS)
sed "s|^PATH=|PATH=$NODEPATH/bin:|mg" -i /etc/environment
fi
export PATH="$NODEPATH/bin:$PATH"
@@ -25,7 +25,7 @@ function replaceEtcEnvironmentVariable {
variable_name="$1"
variable_value="$2"
# modify /etc/environemnt in place by replacing a string that begins with variable_name
# modify /etc/environment in place by replacing a string that begins with variable_name
# removed quotes for the docker env metadata reader
sudo sed -i -e "s%^${variable_name}=.*$%${variable_name}=${variable_value}%" /etc/environment
}
@@ -74,10 +74,10 @@ function appendEtcEnvironmentPath {
# /etc/environment
#
# TODO: there might be the others variables to be processed in the same way as "PATH" variable
# ie MANPATH, INFOPATH, LD_*, etc. In the current implementation the values from /etc/evironments
# ie MANPATH, INFOPATH, LD_*, etc. In the current implementation the values from /etc/environment
# replace the values of the current environment
function reloadEtcEnvironment {
# add `export ` to every variable of /etc/environemnt except PATH and eval the result shell script
# add `export ` to every variable of /etc/environment except PATH and eval the result shell script
eval "$(grep -v '^PATH=' /etc/environment | sed -e 's%^%export %')"
# handle PATH specially
etc_path=$(getEtcEnvironmentVariable PATH)
+2 -2
View File
@@ -20,8 +20,8 @@ echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee
printf "\n\t🐋 Installed NVM 🐋\t\n"
nvm --version
# node 12 and 16 are installed already in act-*
versions=("14")
# node 16 and 18 are already installed in act-*
versions=("20")
JSON=$(wget -qO- https://nodejs.org/download/release/index.json | jq --compact-output)
for V in "${versions[@]}"; do