Skip to content

fix: disable aurora pg db engine minor version upgrade automatically … #43

fix: disable aurora pg db engine minor version upgrade automatically …

fix: disable aurora pg db engine minor version upgrade automatically … #43

name: Build and Publish Docker Image
on:
push:
branches:
- 'dev'
- 'main'
env:
IMAGE_NAME: bcgov/otp-provider
GITHUB_REGISTRY: ghcr.io
IMAGE_TAG: dev
jobs:
build-and-push-image:
permissions:
contents: write
packages: write
runs-on: ubuntu-24.04
environment:
name: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Sandbox' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to github container registry
uses: docker/login-action@v3
with:
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
- name: Cache docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Create release tag
id: release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: rymndhng/release-on-push-action@v0.28.0
with:
bump_version_scheme: 'patch'
tag_prefix: 'v'
use_github_release_notes: 'true'
release_name: 'Release <RELEASE_VERSION>'
max_commits: 100
- name: Set image tag
id: set_image_tag
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "IMAGE_TAG=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
else
echo "IMAGE_TAG=dev" >> $GITHUB_ENV
fi
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.GITHUB_REGISTRY }}/${{env.IMAGE_NAME}}:${{ env.IMAGE_TAG }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache