Skip to content

Merge pull request #15 from RedTurtle/policy_4_0_11 #149

Merge pull request #15 from RedTurtle/policy_4_0_11

Merge pull request #15 from RedTurtle/policy_4_0_11 #149

Workflow file for this run

name: Update gh docker image
on:
# Triggers the workflow on releases
push:
branches:
- main
tags:
- '*'
pull_request:
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-image:
name: Build docker image
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the image id
id: get_image_id
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]')
echo ::set-output name=IMAGE_ID::$IMAGE_ID
- name: Get the version
id: get_version
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo ::set-output name=VERSION::$VERSION
- name: Build and push container image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.get_image_id.outputs.IMAGE_ID }}:${{ steps.get_version.outputs.VERSION }}
platforms: linux/amd64,linux/arm64