Skip to content

temporarily add on: push to docker-release-gha branch #1

temporarily add on: push to docker-release-gha branch

temporarily add on: push to docker-release-gha branch #1

Workflow file for this run

name: Docker Release
# only run this on merge to main
# clone the repo
# set the VERSION environment variable ie `cat packages/runtime/package.json | jq -r '.version'`
# use `docker manifest inspect ohmjs/ohm:$VERION` to verify that the release doesn't already exist before running the rest of the workflow
# create a multi platfrom builder
# build and push the image
on:
push:
branches: [main, docker-release-gha]
workflow_dispatch:
inputs:
VERSION:
description: 'Docker image version to build and push'
required: false
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: |
if [ -n "${{ inputs.VERSION }}" ]; then
echo "VERSION=${{ inputs.VERSION }}" >> "$GITHUB_OUTPUT"
else
echo "VERSION=$(cat packages/runtime/package.json | jq -r '.version')" >> "$GITHUB_OUTPUT"
fi
- name: Check if image already exists
id: check
run: |
if docker manifest inspect ohmjs/ohm:${{ steps.version.outputs.VERSION }} > /dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up QEMU
if: steps.check.outputs.exists == 'false'
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
if: steps.check.outputs.exists == 'false'
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
if: steps.check.outputs.exists == 'false'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: steps.check.outputs.exists == 'false'
uses: docker/bake-action@v7
with:
files: docker/docker-compose.yml
push: true
env:
VERSION: ${{ steps.version.outputs.VERSION }}