forked from oracle/docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (75 loc) · 3.19 KB
/
build-and-push-oci-cli-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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@v3
- 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@v3
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@v6
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 }}