Skip to content

Ignoring any version below 18 #35

Ignoring any version below 18

Ignoring any version below 18 #35

Workflow file for this run

name: Build and Publish
on:
schedule:
# At 04:00 on day-of-month 1.
- cron: "0 4 1 * *"
workflow_dispatch:
push:
branches:
- "main"
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
latest: ${{ steps.latest-version.outputs.matrix }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
- name: Get Docker tags
id: get-tags
run: |
IMAGE_NAME="library/alpine"
curl -s "https://nodejs.org/download/release/index.json" > node_versions.json
- uses: cloudposse/github-action-jq@main
id: parse-tags
with:
compact: true
input: node_versions.json
script: '[.[] | select(.version | test("v(1[8-9]|[2-9][0-9]).*"))] | map(.version) | .[0:200]'
- uses: cloudposse/github-action-jq@main
id: latest-version
with:
compact: true
input: node_versions.json
script: 'map(select(.version | startswith("v20"))) | max_by(.version) | .version'
- name: Set matrix for build
run: |
echo '{"tag": ${{ steps.parse-tags.outputs.output }}}' >> config.json
- uses: cloudposse/github-action-jq@main
id: reparse-tags
with:
compact: true
input: config.json
script: "."
- run: echo 'matrix=${{ steps.reparse-tags.outputs.output }}' >> $GITHUB_OUTPUT
id: set-matrix
build:
needs: prepare-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
logout: true
- name: Build
uses: docker/build-push-action@v5
with:
build-args: |
NODE_VERSION=${{ matrix.tag }}
context: .
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8
push: true
tags: betterweb/node:${{matrix.tag}}