Skip to content

Docker Image CI

Docker Image CI #355

Workflow file for this run

name: Docker Image CI
on:
push:
branches:
- master
schedule:
- cron: 0 12 * * *
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
major: [ 2 ]
os: [ server,client ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set variables
id: vars
working-directory: ${{ matrix.major }}/${{ matrix.os }}
run: |
echo "repository=${GITHUB_ACTOR}/$(basename ${GITHUB_REPOSITORY})" >> $GITHUB_OUTPUT
echo "version=$(grep ' HFISH_VERSION ' Dockerfile | awk -F '[. ]' '{print $3"."$4"."$5}')" >> $GITHUB_OUTPUT
echo "minor_version=$(grep ' HFISH_VERSION ' Dockerfile | awk -F '[. ]' '{print $3"."$4}')" >> $GITHUB_OUTPUT
echo "major_version=$(grep ' HFISH_VERSION ' Dockerfile | awk -F '[. ]' '{print $3}')" >> $GITHUB_OUTPUT
echo "workdir=${{ matrix.major }}/${{ matrix.os }}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
if: ${{ matrix.os == 'server' }}
with:
context: ${{ steps.vars.outputs.workdir }}
pull: true
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.vars.outputs.repository }}:${{ steps.vars.outputs.major_version }}
${{ steps.vars.outputs.repository }}:${{ steps.vars.outputs.minor_version }}
${{ steps.vars.outputs.repository }}:${{ steps.vars.outputs.version }}
- name: Build and push Client
uses: docker/build-push-action@v2
if: ${{ matrix.os == 'client' }}
with:
context: ${{ steps.vars.outputs.workdir }}
pull: true
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.vars.outputs.repository }}:${{ steps.vars.outputs.major_version }}-${{ matrix.os }}
${{ steps.vars.outputs.repository }}:${{ steps.vars.outputs.minor_version }}-${{ matrix.os }}
${{ steps.vars.outputs.repository }}:${{ steps.vars.outputs.version }}-${{ matrix.os }}