Skip to content

Hotfix/2.2.1

Hotfix/2.2.1 #15

name: Build and Publish
on:
pull_request:
push:
branches: [main, develop]
tags: ['*']
workflow_dispatch:
env:
REGISTRY: ghcr.io
BASE_IMG_REPO: ubuntu
BASE_IMG_TAG: 22.04
NARG: 2
jobs:
docker-build-and-publish:
name: Build and push the docker images
strategy:
fail-fast: false
matrix:
build: [Dev, Prod]
include:
- build: Dev
tag-suffix: '-dev'
build-type: Debug
- build: Prod
tag-suffix: ''
build-type: Release
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: recursive
# Need to avoid a shallow clone (fetch-depth=1) so that the lookup of the tag works
fetch-depth: 0
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
flavor: |
latest=auto
suffix=${{ matrix.tag-suffix }},onlatest=true
tags: |
type=semver,pattern={{raw}}
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Get previous tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
id: tag_name
with:
fallback: beta
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
id: build
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: ${{ github.event_name == 'push' && ( contains(github.ref, 'refs/tags/') || github.ref == 'refs/heads/develop' ) }}
build-args: |
base_image=${{ env.BASE_IMG_REPO }}
base_tag=${{ env.BASE_IMG_TAG }}
psyllid_tag=${{ steps.tag_name.outputs.tag }}
build_type=${{ matrix.build-type }}
narg=${{ env.NARG }}
tags: ${{ steps.docker_meta.outputs.tags }}
platforms: linux/amd64
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}