-
Notifications
You must be signed in to change notification settings - Fork 148
62 lines (58 loc) · 1.85 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
name: build-mongodb-atlas-tools-image
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@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- uses: tj-actions/changed-files@6ee9cdc5816333acda68e01cf12eedc619e28316 # v39
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@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Image metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
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@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: "{{defaultContext}}:docker/mongodb-atlas"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}