Skip to content

node 24

node 24 #27

Workflow file for this run

name: node 24
on:
schedule:
- cron: "15 5 * * 1"
workflow_dispatch:
env:
MAJOR_VERSION: 24
jobs:
latest-version:
permissions: {}
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
MAJOR: ${{ steps.get_version.outputs.MAJOR }}
MINOR: ${{ steps.get_version.outputs.MINOR }}
PATCH: ${{ steps.get_version.outputs.PATCH }}
runs-on: ubuntu-latest
steps:
- name: Get version
id: get_version
run: |
latest=$(curl -s "https://hub.docker.com/v2/repositories/library/node/tags?page_size=100&name=${{ env.MAJOR_VERSION }}." | jq -r '.results|.[]|.name' | grep -Ei "^(${{ env.MAJOR_VERSION }}.[0-9]+.[0-9]+)$" | head -1)
ver_major=$(echo $latest | sed -En 's/^([0-9]+)\.[0-9]+\.[0-9]+/\1/p')
ver_minor=$(echo $latest | sed -En 's/^[0-9]+\.([0-9]+)\.[0-9]+/\1/p')
ver_patch=$(echo $latest | sed -En 's/^[0-9]+\.[0-9]+\.([0-9]+)/\1/p')
echo "VERSION=$latest" >> $GITHUB_OUTPUT
echo "MAJOR=$ver_major" >> $GITHUB_OUTPUT
echo "MINOR=$ver_minor" >> $GITHUB_OUTPUT
echo "PATCH=$ver_patch" >> $GITHUB_OUTPUT
build:
needs: latest-version
permissions:
contents: read
packages: write
strategy:
matrix:
arch: ["amd64", "arm64"]
include:
- platform: linux/amd64
runner: ubuntu-latest
arch: amd64
- platform: linux/arm64
runner: ubuntu-24.04-arm
arch: arm64
runs-on: ${{ matrix.runner }}
env:
VERSION: ${{ needs.latest-version.outputs.VERSION }}
MAJOR: ${{ needs.latest-version.outputs.MAJOR }}
MINOR: ${{ needs.latest-version.outputs.MINOR }}
PATCH: ${{ needs.latest-version.outputs.PATCH }}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}/node
tags: |
type=raw,value=${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-${{ matrix.arch }}
flavor: |
latest=false
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/${{ matrix.arch }}
context: ./node/${{ env.MAJOR_VERSION }}
file: ./node/${{ env.MAJOR_VERSION }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ github.repository }}-${{ github.ref_name }}-node-${{ env.VERSION }}-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ github.repository }}-${{ github.ref_name }}-node-${{ env.VERSION }}-${{ matrix.arch }}
create-multiarch-manifests:
needs: ["latest-version", "build"]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
MAJOR: ${{ needs.latest-version.outputs.MAJOR }}
MINOR: ${{ needs.latest-version.outputs.MINOR }}
PATCH: ${{ needs.latest-version.outputs.PATCH }}
defaults:
run:
shell: bash
steps:
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create multiarch manifests - registry
run: |
docker buildx imagetools create \
-t ghcr.io/${{ github.repository }}/node:${{ env.MAJOR }} \
-t ghcr.io/${{ github.repository }}/node:${{ env.MAJOR }}.${{ env.MINOR }} \
-t ghcr.io/${{ github.repository }}/node:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} \
ghcr.io/${{ github.repository }}/node:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-amd64 \
ghcr.io/${{ github.repository }}/node:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-arm64