Skip to content

set latest

set latest #88

Workflow file for this run

name: publish docker image
on:
workflow_dispatch:
push:
branches:
- "master"
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "17 3 * * 0"
jobs:
build:
env:
# Setting the defaults up front
LATEST_NODE: 20
DEFAULT_IMAGE: smilerz/node-red
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
- name: Get Date
id: date
# run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%SZ')"
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=true
images: |
${{ env.DEFAULT_IMAGE }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
- name: Get Node-RED Version
id: nrVersion
run: |
TAGS=""
while IFS= read -r TAG;do
if [ -z "$TAGS" ]; then
TAGS=$TAG
else
TAGS="$TAGS,$TAG"
fi
done <<< "${{ steps.meta.outputs.tags }}"
echo $TAGS
echo "::set-output name=tags::$TAGS"
echo "::set-output name=version::$(echo $GITHUB_REF | awk -F '/' '{ print $3}')"
echo "::set-output name=buildVersion::$VERSION"
- name: Build and push
id: build-push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
file: .docker/Dockerfile.debian
pull: true
push: true
no-cache: true
build-args: |
NODE_VERSION=${{ env.LATEST_NODE }}
BUILD_DATE=${{ steps.date.outputs.date }}
BUILD_REF=${{ env.GITHUB.SHA }}
NODE_RED_VERSION=${{ steps.nrVersion.outputs.version }}
BUILD_VERSION=${{ steps.nrVersion.outputs.buildVersion }}
tags: "${{ steps.nrVersion.outputs.tags }}"