-
Notifications
You must be signed in to change notification settings - Fork 156
65 lines (60 loc) · 1.89 KB
/
atlas-image-build.yaml
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
name: build-mongodb-atlas-tools-image
permissions:
contents: read
on:
workflow_dispatch:
inputs:
tag:
description: 'MongoDB Atlas image tag in the format x.y.z'
required: true
type: string
env:
REGISTRY: ghcr.io
IMAGE_NAME: kanisterio/mongodb-atlas
jobs:
check-files:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45.0.4
name: Get changed files
id: changed-files
with:
files: docker/mongodb-atlas/Dockerfile
build:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
needs: check-files
if: needs.check-files.outputs.changed == 'true'
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Image metadata
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha
{{date 'YYYY.MM.DD-HHmm'}}
${{ inputs.tag }}
- name: Login to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: "{{defaultContext}}:docker/mongodb-atlas"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}