-
Notifications
You must be signed in to change notification settings - Fork 32
110 lines (94 loc) · 3.27 KB
/
template-push.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# This runs the sanity checks on all the platforms, then build and push the
# images to the Docker registries.
name: Push
on:
workflow_call:
inputs:
directory:
description: Directory where the Dockerfile is
required: true
type: string
platforms:
description: The platforms to build on
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
description: Docker Hub username
required: true
DOCKERHUB_TOKEN:
description: Docker Hub token
required: true
env:
images: |
index.docker.io/multani/nomad
ghcr.io/multani/nomad
jobs:
test:
uses: ./.github/workflows/template-build.yml
secrets: inherit
with:
directory: ${{ inputs.directory }}
platforms: ${{ inputs.platforms }}
push:
runs-on: ubuntu-latest
needs:
- test
permissions:
packages: write # create new package versions
steps:
- uses: actions/checkout@v4
- name: Metadata
id: meta
working-directory: ${{ inputs.directory }}
env:
DIRECTORY: ${{ inputs.directory }}
run: |
echo "nomad=$(cat nomad-version)" >> "$GITHUB_OUTPUT"
echo "dockerfile=${DIRECTORY}/Dockerfile" >> "$GITHUB_OUTPUT"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
id: docker-setup
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ inputs.platforms }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker metadata
id: docker-release
uses: docker/metadata-action@v5
with:
images: ${{ env.images }}
labels: |
org.opencontainers.image.authors=Jonathan Ballet <[email protected]>
org.opencontainers.image.url=https://www.nomadproject.io/
org.opencontainers.image.documentation=https://www.nomadproject.io/docs
org.opencontainers.image.source=https://github.com/hashicorp/nomad
org.opencontainers.image.version=${{ steps.meta.outputs.nomad }}
org.opencontainers.image.vendor=HashiCorp
org.opencontainers.image.title=nomad
org.opencontainers.image.description=Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications.
tags: |
type=ref,event=tag
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ${{ inputs.directory }}
file: ${{ steps.meta.outputs.dockerfile }}
build-args: |-
NOMAD_VERSION=${{ steps.meta.outputs.nomad }}
platforms: ${{ inputs.platforms }}
provenance: false
push: true
tags: ${{ steps.docker-release.outputs.tags }}
labels: ${{ steps.docker-release.outputs.labels }}