Skip to content

Bump docker/setup-buildx-action from 2 to 3 #92

Bump docker/setup-buildx-action from 2 to 3

Bump docker/setup-buildx-action from 2 to 3 #92

name: Build and Push OCI CLI Image
on:
workflow_dispatch:
schedule:
- cron: '30 0 * * 3' # Tuesday@17h30 Pacific = Wednesday@00h30 UTC
push:
branches: [ "main" ]
paths:
- 'OracleCloudInfrastructuree/oci-cli/*'
- '.github/workflows/build-and-push-oci-cli-image.yml'
pull_request:
paths:
- 'OracleCloudInfrastructuree/oci-cli/*'
- '.github/workflows/build-and-push-oci-cli-image.yml'
branches: [ "main" ]
env:
IMAGE_NAME: oci-cli
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Lowercase repository owner
id: repo-owner
run: |
echo "repo-owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Log into GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate container image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ steps.repo-owner.outputs.repo-owner }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
labels: |
provider=${REPO_OWNER}
issues=https://github.com/${{ steps.repo-owner.outputs.repo-owner }}/docker-images/issues
org.opencontainers.image.licenses=UPL-1.0
org.opencontainers.image.vendor=${REPO_OWNER}
org.opencontainers.image.title=OCI CLI
org.opencontainers.image.description=Oracle Cloud Infrastructure Command Line Interface
org.opencontainers.image.source=https://github.com/oracle/docker-images/tree/main/OracleCloudInfrastructure/oci-cli
org.opencontainers.image.documentation=https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cliconcepts.htm
org.opencontainers.image.url=https://github.com/${{ steps.repo-owner.outputs.repo-owner }}/docker-images/pkgs/container/oci-cli
org.opencontainers.image.base.name=ghcr.io/${{ steps.repo-owner.outputs.repo-owner }}/oci-cli:latest
tags: |
type=schedule,pattern={{date 'YYYYMMDD'}}
type=sha
- name: Build and push image
id: build-and-push
uses: docker/build-push-action@v4
with:
build-args: |
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
context: ./OracleCloudInfrastructure/oci-cli/
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64, linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}