Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to ghcr.io #478

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:
# Setting the defaults up front
LATEST_NODE: 20
DEFAULT_IMAGE: nodered/node-red
GH_IMAGE: ghcr.io/node-red/node-red
DEV_IMAGE: nodered/node-red-dev
GH_DEV_IMAGE: ghcr.io/node-red/node-red-dev
runs-on: ubuntu-latest

strategy:
Expand All @@ -48,6 +50,7 @@ jobs:
suffix=-${{matrix.node}}${{matrix.suffix}}
images: |
${{ env.DEFAULT_IMAGE }}
${{ env.GH_IMAGE }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
Expand Down Expand Up @@ -118,29 +121,32 @@ jobs:

if [[ "$TRAVIS_TAG" =~ ^v[0-9\.-]*$ ]]; then
IMAGE=${{ env.DEFAULT_IMAGE }}
GH_IMAGE=${{ env.GH_IMAGE}}
PUSH=true
VERSION=${TRAVIS_TAG:1}
STABLE_VERSION=`echo ${VERSION} | sed -r 's/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$/\1.\2/'`

if [[ "${{ matrix.node }}" == "${{ env.LATEST_NODE }}" && "${{ matrix.suffix }}" == "" ]]; then
TAGS="$TAGS,$IMAGE:$VERSION,$IMAGE:$STABLE_VERSION,$IMAGE:latest"
TAGS="$TAGS,$IMAGE:$VERSION,$IMAGE:$STABLE_VERSION,$IMAGE:latest,$GH_IMAGE:$VERSION,$GH_IMAGE:$STABLE_VERSION,$GH_IMAGE:latest"
elif [[ "${{ matrix.node }}" == "${{ env.LATEST_NODE }}" && "${{ matrix.suffix }}" == "-minimal" ]]; then
TAGS="$TAGS,$IMAGE:$VERSION-minimal,$IMAGE:latest-minimal"
TAGS="$TAGS,$IMAGE:$VERSION-minimal,$IMAGE:latest-minimal,$GH_IMAGE:$VERSION-minimal,$GH_IMAGE:latest-minimal"
fi

TAGS="$TAGS,$IMAGE:latest-${{ matrix.node }}${{ matrix.suffix }}"
TAGS="$TAGS,$IMAGE:latest-${{ matrix.node }}${{ matrix.suffix }},$GH_IMAGE:latest-${{ matrix.node }}${{ matrix.suffix }}"

else
IMAGE=${{ env.DEV_IMAGE }}
GH_IMAGE=${{ env.GH_DEV_IMAGE}}
if [[ "$TRAVIS_TAG" == *"dev"* || "$TRAVIS_TAG" == *"beta"* ]]; then
PUSH=true
else
PUSH=false
fi
VERSION=${TRAVIS_TAG}
TAGS=$(echo $TAGS | sed 's!${{ env.DEFAULT_IMAGE}}!${{ env.DEV_IMAGE }}!')
TAGS=$(echo $TAGS | sed 's!${{ env.GH_IMAGE}}!${{ env.GH_DEV_IMAGE }}!')
if [ "${{ matrix.node }}" == "${{ env.LATEST_NODE }}" ] && [ "${{ matrix.suffix}}" == "" ]; then
TAGS="$TAGS,$IMAGE:$VERSION"
TAGS="$TAGS,$IMAGE:$VERSION,$GH_IMAGE:$VERSION"
fi
fi

Expand Down Expand Up @@ -175,6 +181,13 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
id: build-push
Expand Down Expand Up @@ -216,6 +229,12 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Date
id: date
# run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%SZ')"
Expand All @@ -228,6 +247,7 @@ jobs:
latest=false
images: |
${{ env.DEFAULT_IMAGE }}
${{ env.GH_IMAGE }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
Expand All @@ -248,14 +268,16 @@ jobs:
if [[ "$TRAVIS_TAG" =~ ^v[0-9\.-]*$ ]]; then
# release build
IMAGE=${{ env.DEFAULT_IMAGE }}
GH_IMAGE=${{ env.GH_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"
TAGS="$IMAGE:latest-debian,$IMAGE:$VERSION-debian,$IMAGE:$STABLE_VERSION-debian,$GH_IMAGE:latest-debian,$GH_IMAGE:$VERSION-debian,$GH_IMAGE:$STABLE_VERSION-debian"

else
IMAGE=${{ env.DEV_IMAGE }}
GH_IMAGE=${{ env.GH_DEV_IMAGE}}
if [[ "$TRAVIS_TAG" == *"dev"* || "$TRAVIS_TAG" == *"beta"* ]]; then
# beta build
PUSH=true
Expand All @@ -264,7 +286,7 @@ jobs:
fi
VERSION=${TRAVIS_TAG}

TAGS="$IMAGE:$VERSION-debian"
TAGS="$IMAGE:$VERSION-debian,$GH_DEV_IMAGE:$VERSION"

fi

Expand Down