Files
docker-nodejs/.github/workflows/build-push.yml
2025-09-26 15:17:34 +02:00

76 lines
2.1 KiB
YAML

name: Build & Push Electron-Builder Windows Images
on:
push:
branches: [ "main" ]
tags:
- "v*"
workflow_dispatch: {}
env:
IMAGE_NAME: mrunknownde/electron-builder-windows
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: Dockerfile.node22
short_tag: node22
latest: "true"
- dockerfile: Dockerfile.node20
short_tag: node20
latest: "false"
- dockerfile: Dockerfile.node18
short_tag: node18
latest: "false"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ matrix.short_tag }}
# Optional: also tag by git sha for traceability
type=sha,format=long,prefix=${{ matrix.short_tag }}-
labels: |
org.opencontainers.image.title=electron-builder-windows
org.opencontainers.image.source=${{ github.repositoryUrl }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.dockerfile }}
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Optionally mark Node20 as "latest"
- name: Also push :latest (only for Node 20)
if: ${{ matrix.latest == 'true' }}
run: |
docker buildx imagetools create \
--tag ${{ env.IMAGE_NAME }}:latest \
${{ env.IMAGE_NAME }}:${{ matrix.short_tag }}