Skip to content

.github/workflows/liquibase-build.yml #39

.github/workflows/liquibase-build.yml

.github/workflows/liquibase-build.yml #39

env:
IMAGE_NAME: ${{ github.repository }}-liquibase
permissions:
contents: read
packages: write
on:
pull_request_target:
types:
- closed
branches:
- 'main'
paths:
- ".github/workflows/**"
- "client/**"
- "server/**"
- "db/**"
- "!**/README.md"
workflow_dispatch:
inputs:
TAG:
required: false
type: string
description: 'Additional tag to add to docker image'
workflow_call:
inputs:
TAG:
required: false
type: string
description: 'workflow'
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- id: trimBranchName
name: trim branch name if necessary
run: |
export branchTag="${{ github.ref_name }}"
trimTag="${branchTag##*/}"
echo "BRANCH_TAG=$trimTag" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ vars.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker (with PR)
# if: ${{ github.event.pull_request.number > 0 || inputs.IS_HOTFIX == 'true' }}
id: meta_pr
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ vars.REGISTRY}}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=raw,value=${{ steps.trimBranchName.outputs.BRANCH_TAG }}
type=ref,event=tag
type=raw,value=${{ inputs.TAG }}
- name: Build and push Liquibase image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: db
push: true
tags: ${{ steps.meta_pr.outputs.tags }}
labels: ${{ steps.meta_pr.outputs.labels }}