fix publish #31
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
--- | |
# Automatically build Docker images on changes to main and push them to a | |
# Container Registry using HCL Bake file. | |
name: Build Docker Images | |
# yamllint disable-line rule:truthy | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['develop','demo_*','hackathon_*'] | |
tags: ['*'] | |
pull_request: | |
branches: ['develop'] | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
# Call the Tag Generator to generate an image tag to use | |
tag-generator: | |
uses: darpa-askem/.github/.github/workflows/tag-generator.yaml@main | |
with: | |
branch: 'develop' | |
amd64: | |
name: build-amd64 | |
runs-on: ubuntu-22.04 | |
needs: | |
- tag-generator | |
steps: | |
- name: Set env variables for bakefiles | |
run: | | |
# Lowercase the inputs for Docker image naming conventions | |
TAG=${{ needs.tag-generator.outputs.tag }} | |
ORG=${{ github.repository_owner }} | |
# REG=${{ inputs.registry }} | |
echo "VERSION=${TAG,,}" >> ${GITHUB_ENV} | |
echo "DOCKER_ORG=${ORG,,}" >> ${GITHUB_ENV} | |
echo "BUILDX_NO_DEFAULT_ATTESTATIONS=1" >> ${GITHUB_ENV} | |
# echo "DOCKER_REGISTRY=${REG,,}" >> ${GITHUB_ENV} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: 'ghcr.io' | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# 2.5 - Setup Docker BuildX for multi platform building | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# 2.6 - Build and push Docker Images | |
- name: Build Images using BuildX Bake | |
uses: docker/[email protected] | |
with: | |
files: | | |
./docker/docker-bake.hcl | |
targets: funman-base-amd64 | |
push: true | |
sbom: false | |
provenance: false | |
set: | | |
*.cache-from=type=gha | |
*.cache-to=type=gha,mode=max | |
arm64: | |
name: build-arm64 | |
runs-on: macos-latest-xl | |
needs: | |
- tag-generator | |
steps: | |
- name: Set env variables for bakefiles | |
run: | | |
# Lowercase the inputs for Docker image naming conventions | |
TAG=${{ needs.tag-generator.outputs.tag }} | |
ORG=${{ github.repository_owner }} | |
# REG=${{ inputs.registry }} | |
echo "VERSION=${TAG,,}" >> ${GITHUB_ENV} | |
echo "DOCKER_ORG=${ORG,,}" >> ${GITHUB_ENV} | |
echo "BUILDX_NO_DEFAULT_ATTESTATIONS=1" >> ${GITHUB_ENV} | |
# echo "DOCKER_REGISTRY=${REG,,}" >> ${GITHUB_ENV} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: 'ghcr.io' | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# 2.5 - Setup Docker BuildX for multi platform building | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# 2.6 - Build and push Docker Images | |
- name: Build Images using BuildX Bake | |
uses: docker/[email protected] | |
with: | |
files: | | |
./docker/docker-bake.hcl | |
targets: funman-base-arm64 | |
push: true | |
sbom: false | |
provenance: false | |
set: | | |
*.cache-from=type=gha | |
*.cache-to=type=gha,mode=max | |
merge-images: | |
name: Merge AMD64 and ARM64 images under one manifest | |
needs: | |
- tag-generator | |
- amd64 | |
- arm64 | |
uses: ./.github/workflows/merge-images.yml | |
with: | |
name: ${{ needs.tag-generator.outputs.tag }} |