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:
@@ -20,7 +20,7 @@ env:
|
|||||||
IMAGE_LABEL_REPO: ${{ github.repository }}
|
IMAGE_LABEL_REPO: ${{ github.repository }}
|
||||||
SLUG: ${{ github.repository_owner }}/ubuntu
|
SLUG: ${{ github.repository_owner }}/ubuntu
|
||||||
DISTRO: ubuntu
|
DISTRO: ubuntu
|
||||||
NODE: '16'
|
NODE: '16 18'
|
||||||
BUILD_REF: ${{ github.sha }}
|
BUILD_REF: ${{ github.sha }}
|
||||||
SKIP_TEST: false
|
SKIP_TEST: false
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ jobs:
|
|||||||
)
|
)
|
||||||
|
|
||||||
- if: ${{ !env.SKIP_TEST }}
|
- if: ${{ !env.SKIP_TEST }}
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '^1.16'
|
go-version: '^1.16'
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
- `ghcr.io/catthehacker/ubuntu:runner-20.04`
|
- `ghcr.io/catthehacker/ubuntu:runner-20.04`
|
||||||
- `ghcr.io/catthehacker/ubuntu:runner-22.04`
|
- `ghcr.io/catthehacker/ubuntu:runner-22.04`
|
||||||
- `ghcr.io/catthehacker/ubuntu:runner-latest`
|
- `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-20.04`
|
||||||
- `ghcr.io/catthehacker/ubuntu:js-22.04`
|
- `ghcr.io/catthehacker/ubuntu:js-22.04`
|
||||||
- `ghcr.io/catthehacker/ubuntu:js-latest`
|
- `ghcr.io/catthehacker/ubuntu:js-latest`
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ ARG FROM_IMAGE
|
|||||||
ARG FROM_TAG
|
ARG FROM_TAG
|
||||||
|
|
||||||
# > Our custom ARGs
|
# > Our custom ARGs
|
||||||
ARG NODE_VERSION="12 16"
|
# latest Node.js LTS versions
|
||||||
|
ARG NODE_VERSION="16 18"
|
||||||
ARG DISTRO=ubuntu
|
ARG DISTRO=ubuntu
|
||||||
ARG TYPE=act
|
ARG TYPE=act
|
||||||
ARG RUNNER
|
ARG RUNNER
|
||||||
|
|||||||
@@ -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"
|
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"
|
tar -Jxf "node-$VER-linux-$(node_arch).tar.xz" --strip-components=1 -C "$NODEPATH"
|
||||||
rm "node-$VER-linux-$(node_arch).tar.xz"
|
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
|
sed "s|^PATH=|PATH=$NODEPATH/bin:|mg" -i /etc/environment
|
||||||
fi
|
fi
|
||||||
export PATH="$NODEPATH/bin:$PATH"
|
export PATH="$NODEPATH/bin:$PATH"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function replaceEtcEnvironmentVariable {
|
|||||||
variable_name="$1"
|
variable_name="$1"
|
||||||
variable_value="$2"
|
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
|
# removed quotes for the docker env metadata reader
|
||||||
sudo sed -i -e "s%^${variable_name}=.*$%${variable_name}=${variable_value}%" /etc/environment
|
sudo sed -i -e "s%^${variable_name}=.*$%${variable_name}=${variable_value}%" /etc/environment
|
||||||
}
|
}
|
||||||
@@ -74,10 +74,10 @@ function appendEtcEnvironmentPath {
|
|||||||
# /etc/environment
|
# /etc/environment
|
||||||
#
|
#
|
||||||
# TODO: there might be the others variables to be processed in the same way as "PATH" variable
|
# 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
|
# replace the values of the current environment
|
||||||
function reloadEtcEnvironment {
|
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 %')"
|
eval "$(grep -v '^PATH=' /etc/environment | sed -e 's%^%export %')"
|
||||||
# handle PATH specially
|
# handle PATH specially
|
||||||
etc_path=$(getEtcEnvironmentVariable PATH)
|
etc_path=$(getEtcEnvironmentVariable PATH)
|
||||||
|
|||||||
@@ -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"
|
printf "\n\t🐋 Installed NVM 🐋\t\n"
|
||||||
nvm --version
|
nvm --version
|
||||||
|
|
||||||
# node 12 and 16 are installed already in act-*
|
# node 16 and 18 are already installed in act-*
|
||||||
versions=("14")
|
versions=("20")
|
||||||
JSON=$(wget -qO- https://nodejs.org/download/release/index.json | jq --compact-output)
|
JSON=$(wget -qO- https://nodejs.org/download/release/index.json | jq --compact-output)
|
||||||
|
|
||||||
for V in "${versions[@]}"; do
|
for V in "${versions[@]}"; do
|
||||||
|
|||||||
Reference in New Issue
Block a user