Skip to content

Prepare for 0.9.3 release #100

Prepare for 0.9.3 release

Prepare for 0.9.3 release #100

name: 'build stable images'
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
# TODO: only request needed permissions
permissions: write-all
jobs:
docker:
runs-on: ubuntu-latest
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
# support dockerhub organizations. If none is present, use the dockerhub username
DOCKERHUB_ORGANIZATION: ${{ secrets.DOCKERHUB_ORGANIZATION == null && secrets.DOCKERHUB_USERNAME || secrets.DOCKERHUB_ORGANIZATION }}
steps:
- uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
if: env.DOCKERHUB_USERNAME != null
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- id: lowercase-repository
name: lowercase repository
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
- name: Build and push (GHCR only)
uses: docker/build-push-action@v5
if: env.DOCKERHUB_ORGANIZATION == null
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ steps.lowercase-repository.outputs.lowercase }}/saic-mqtt-gateway:latest
ghcr.io/${{ steps.lowercase-repository.outputs.lowercase }}/saic-mqtt-gateway:${{ env.RELEASE_VERSION }}
- name: Build and push (GHCR + DockerHub)
uses: docker/build-push-action@v5
if: env.DOCKERHUB_ORGANIZATION != null
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ steps.lowercase-repository.outputs.lowercase }}/saic-mqtt-gateway:latest
ghcr.io/${{ steps.lowercase-repository.outputs.lowercase }}/saic-mqtt-gateway:${{ env.RELEASE_VERSION }}
${{ secrets.DOCKERHUB_ORGANIZATION != null && format('{0}/saic-python-mqtt-gateway:latest', secrets.DOCKERHUB_ORGANIZATION)}}
${{ secrets.DOCKERHUB_ORGANIZATION != null && format('{0}/saic-python-mqtt-gateway:{1}', secrets.DOCKERHUB_ORGANIZATION, env.RELEASE_VERSION)}}