Build and deploy Bay images #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-deploy-bay-images | |
run-name: Build and deploy Bay images | |
on: | |
schedule: | |
- cron: '23 20 * * 0' | |
workflow_dispatch: | |
push: | |
branches: | |
- 'build/**' | |
pull_request_target: | |
types: | |
- closed | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
buildx: | |
if: github.event.pull_request.merged == true || startsWith(github.head_ref, 'build/') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
images: ${{ fromJson(vars.IMAGES) }} | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- uses: actions/checkout@v3 | |
- name: Login to registry ${{ env.REGISTRY }} | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.REGISTRY_USER }} | |
password: ${{ secrets.REGISTRY_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.images }} | |
tags: | | |
type=ref,event=branch | |
labels: | | |
maintainer=Digital Victoria | |
repository=${{ github.repositoryUrl }} | |
org.opencontainers.image.authors=Digital Victoria | |
org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}/images/${{ matrix.images }}/Dockerfile | |
org.opencontainers.image.title=${{ matrix.images }} | |
org.opencontainers.image.description=${{ matrix.images }} image for Bay container platform | |
- name: Build and push the images | |
uses: docker/[email protected] | |
with: | |
push: true | |
files: | | |
./gh-actions-bake.hcl | |
${{ steps.meta.outputs.bake-file }} | |
# Target the default group - probably unnecessary. | |
targets: ${{ matrix.images }} |