tjsr Building and pushing node_patched_npm #82
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
run-name: ${{ github.actor }} Building and pushing node_patched_npm | |
on: [push] | |
env: | |
NODE_VERSION: '20.15.1' | |
ALPINE_VERSION: '3.20' | |
NPM_VERSION: '10.8.2' | |
jobs: | |
node_matrix: | |
strategy: | |
matrix: | |
# '18.20.3', '20.13.1', '20.14.0' | |
node_version: ['20.15.1'] | |
alpine_version: ['3.20'] | |
# '10.7.0', | |
npm_version: ['10.8.2'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Ensure output dirs exists | |
run: | | |
mkdir -p /tmp/amd64/node_patched_npm | |
mkdir -p /tmp/arm64/node_patched_npm | |
mkdir -p /tmp/node_patched_npm | |
- name: Build and push all docker images. | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
cache-to: type=gha,mode=max | |
cache-from: type=gha | |
build-args: | | |
NODE_VERSION=${{ matrix.node_version }} | |
ALPINE_VERSION=${{ matrix.alpine_version }} | |
NPM_VERSION=${{ matrix.npm_version }} | |
tags: ghcr.io/tjsr/node_patched_npm:${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }} | |
outputs: | | |
type=oci,dest=/tmp/node_patched_npm/${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }}.tar | |
type=registry,ref=ghcr.io/tjsr/node_patched_npm:${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }} | |
- name: Upload OCI multi-platform image | |
if: ${{ matrix.node_version }} == ${{ env.NODE_VERSION }} && ${{ matrix.alpine_version }} == ${{ env.ALPINE_VERSION }} && ${{ matrix.npm_version }} == ${{ env.NPM_VERSION }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: node_patched_npm_${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }} | |
path: /tmp/node_patched_npm/${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }}.tar | |
# - name: Build and push arm64 docker image. | |
# uses: docker/build-push-action@v6 | |
# with: | |
# context: . | |
# push: true | |
# platforms: | | |
# linux/arm64 | |
# cache-to: type=gha,mode=max | |
# cache-from: type=gha | |
# build-args: | | |
# NODE_VERSION=${{ matrix.node_version }} | |
# ALPINE_VERSION=${{ matrix.alpine_version }} | |
# NPM_VERSION=${{ matrix.npm_version }} | |
# tags: ghcr.io/tjsr/node_patched_npm:${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }} | |
# outputs: | | |
# type=docker,dest=/tmp/arm64/node_patched_npm/${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }}.tar | |
# type=registry,ref=ghcr.io/tjsr/node_patched_npm:${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }} | |
# - name: Upload arm64 image | |
# if: ${{ matrix.node_version }} == ${{ env.NODE_VERSION }} && ${{ matrix.alpine_version }} == ${{ env.ALPINE_VERSION }} && ${{ matrix.npm_version }} == ${{ env.NPM_VERSION }} | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: arm64_node_patched_npm_${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }} | |
# path: /tmp/arm64/node_patched_npm/${{ matrix.node_version }}-alpine${{ matrix.alpine_version }}-npm${{ matrix.npm_version }}.tar | |
latest: | |
runs-on: ubuntu-latest | |
needs: node_matrix | |
steps: | |
- name: Get branch names. | |
id: branch-names | |
uses: tj-actions/branch-names@v8 | |
- name: Running on any event. | |
run: | | |
echo "Default branch: ${{ steps.branch-names.outputs.default_branch }}" | |
# Outputs: "Default branch: main" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download amd64 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: amd64_node_patched_npm_${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }}-npm${{ env.NPM_VERSION }} | |
path: /tmp/amd64/node_patched_npm | |
- name: Download OCI multi-platform artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: node_patched_npm_${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }}-npm${{ env.NPM_VERSION }} | |
path: /tmp/node_patched_npm | |
- name: Load tagged OCI multi-platform image. | |
id: load-oci | |
continue-on-error: true | |
run: | | |
docker load --input /tmp/node_patched_npm/${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }}-npm${{ env.NPM_VERSION }}.tar | |
# - name: Load tagged arm64 image. | |
# id: load-arm4 | |
# continue-on-error: true | |
# run: | | |
# docker load --input /tmp/arm64/node_patched_npm/${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }}-npm${{ env.NPM_VERSION }}.tar | |
- name: Tag the latest image | |
if: steps.branch-names.outputs.current_branch == 'develop/actions' && steps.load-oci.outputs.exit-code == 0 | |
run: | | |
docker tag ghcr.io/tjsr/node_patched_npm:${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }}-npm${{ env.NPM_VERSION }} ghcr.io/tjsr/node_patched_npm:latest | |
- name: Pull, tag and push the latest image | |
if: github.ref == 'refs/heads/main' | |
run: | | |
docker pull ghcr.io/tjsr/node_patched_npm:${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }}-npm${{ env.NPM_VERSION }} || true | |
docker tag ghcr.io/tjsr/node_patched_npm:${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }}-npm${{ env.NPM_VERSION }} ghcr.io/tjsr/node_patched_npm:latest | |
docker push ghcr.io/tjsr/node_patched_npm:latest | |
- name: Pull, tag and push the latest image | |
if: steps.branch-names.outputs.current_branch == 'develop/actions' | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/tjsr/node_patched_npm | |
flavor: | | |
latest=false | |
prefix= | |
suffix= | |
tags: | | |
type=raw,latest | |
type=raw,latest-alpine${{ env.ALPINE_VERSION }}-npm${{ env.NPM_VERSION }} | |
type=raw,latest-alpine-latest-npm${{ env.NPM_VERSION }} | |
type=raw,latest-npm${{ env.NPM_VERSION }} | |
type=raw,latest-alpine-${{ env.ALPINE_VERSION }}-npm-latest | |
type=raw,latest-alpine-${{ env.ALPINE_VERSION }} | |
type=raw,${{ env.NODE_VERSION }}-alpine-latest-npm${{ env.NPM_VERSION }} | |
type=raw,${{ env.NODE_VERSION }}-npm${{ env.NPM_VERSION }}-latest | |
type=raw,${{ env.NODE_VERSION }}-npm${{ env.NPM_VERSION }} | |
type=raw,${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }}-npm-latest | |
type=raw,${{ env.NODE_VERSION }}-alpine${{ env.ALPINE_VERSION }} | |
type=raw,${{ env.NODE_VERSION }}-alpine-latest-npm-latest | |
type=raw,${{ env.NODE_VERSION }}-latest | |
type=raw,${{ env.NODE_VERSION }} | |
- name: Push tagged images | |
run: | |
docker push --all-tags ghcr.io/tjsr/node_patched_npm | |