Skip to content

Commit

Permalink
Cleanup and reintroduce all versions, only tag latest on main.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjsr committed Jul 12, 2024
1 parent 61e6d2e commit b389b3c
Showing 1 changed file with 5 additions and 73 deletions.
78 changes: 5 additions & 73 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ jobs:
node_matrix:
strategy:
matrix:
# '18.20.3', '20.13.1', '20.14.0'
node_version: ['20.15.1']
node_version: ['18.20.3', '20.13.1', '20.14.0', '20.15.1']
alpine_version: ['3.20']
# '10.7.0',
npm_version: ['10.8.2']
npm_version: ['10.7.0', '10.8.2']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -32,12 +30,6 @@ jobs:
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:
Expand All @@ -52,42 +44,16 @@ jobs:
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=oci,dest=/tmp/${{ 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
path: /tmp/${{ 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
Expand Down Expand Up @@ -123,11 +89,10 @@ jobs:
- name: Load tagged OCI multi-platform image.
id: load-oci
run: |
ls -lah /tmp/node_patched_npm
docker import /tmp/node_patched_npm/${{ env.LATEST_IMAGE_TAG }}.tar ghcr.io/tjsr/node_patched_npm:${{ env.LATEST_IMAGE_TAG }}
- name: Tag the latest image with all the variants we want
if: steps.branch-names.outputs.current_branch == 'develop/actions' && steps.load-oci.outputs.exit-code == 0
if: github.ref == 'refs/heads/main'
run: |
docker tag ghcr.io/tjsr/node_patched_npm:${{ env.LATEST_IMAGE_TAG }} ghcr.io/tjsr/node_patched_npm
docker tag ghcr.io/tjsr/node_patched_npm:${{ env.LATEST_IMAGE_TAG }} ghcr.io/tjsr/node_patched_npm:latest
Expand All @@ -145,39 +110,6 @@ jobs:
docker tag ghcr.io/tjsr/node_patched_npm:${{ env.LATEST_IMAGE_TAG }} ghcr.io/tjsr/node_patched_npm:${{ env.NODE_VERSION }}-latest
docker tag ghcr.io/tjsr/node_patched_npm:${{ env.LATEST_IMAGE_TAG }} ghcr.io/tjsr/node_patched_npm:${{ env.NODE_VERSION }}
- 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
Expand Down

0 comments on commit b389b3c

Please sign in to comment.