Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
smilerz committed Aug 26, 2024
1 parent 47bf8d6 commit 610af45
Showing 1 changed file with 15 additions and 40 deletions.
55 changes: 15 additions & 40 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "master"
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '17 3 * * 0'
- cron: "17 3 * * 0"

jobs:
build:
Expand All @@ -31,13 +31,13 @@ jobs:
- 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
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=false
latest=true
images: |
${{ env.DEFAULT_IMAGE }}
tags: |
Expand All @@ -49,58 +49,33 @@ jobs:
run: |
TAGS=""
echo Original tags ${{ steps.meta.outputs.tags }}
if [[ ! -z "${{ github.event.inputs.version }}" ]]; then
TRAVIS_TAG=${{ github.event.inputs.version }}
else
TRAVIS_TAG=$(echo $GITHUB_REF | awk -F '/' '{ print $3}')
fi
if [[ "$TRAVIS_TAG" =~ ^v[0-9\.-]*$ ]]; then
# release build
IMAGE=${{ env.DEFAULT_IMAGE }}
PUSH=true
VERSION=${TRAVIS_TAG:1}
STABLE_VERSION=`echo ${VERSION} | sed -r 's/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$/\1.\2/'`
TAGS="$IMAGE:latest-debian,$IMAGE:$VERSION-debian,$IMAGE:$STABLE_VERSION-debian"
else
IMAGE=${{ env.DEV_IMAGE }}
if [[ "$TRAVIS_TAG" == *"dev"* || "$TRAVIS_TAG" == *"beta"* ]]; then
# beta build
PUSH=true
while IFS= read -r TAG;do
if [ -z "$TAGS" ]; then
TAGS=$TAG
else
PUSH=false
TAGS="$TAGS,$TAG"
fi
VERSION=${TRAVIS_TAG}
TAGS="$IMAGE:$VERSION-debian"
fi
done <<< "${{ steps.meta.outputs.tags }}"
echo $TAGS
echo "tags=$TAGS" >> $GITHUB_OUTPUT
echo "push=$PUSH" >> $GITHUB_OUTPUT
echo "version=$TRAVIS_TAG" >> $GITHUB_OUTPUT
echo "buildVersion=$VERSION" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
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, linux/arm64, linux/arm/v7
platforms: linux/amd64
file: .docker/Dockerfile.debian
push: ${{ steps.nrVersion.outputs.push }}
pull: true
push: true
build-args: |
NODE_VERSION=${{ env.LATEST_NODE }}
BUILD_DATE=${{ steps.date.outputs.date }}
BUILD_REF=${{ env.GITHUB.SHA }}
TAG_SUFFIX=-debian
NODE_RED_VERSION=${{ steps.nrVersion.outputs.version }}
BUILD_VERSION=${{ steps.nrVersion.outputs.buildVersion }}
tags: ${{ steps.nrVersion.outputs.tags }}
tags: "${{ steps.nrVersion.outputs.tags }}"

0 comments on commit 610af45

Please sign in to comment.