-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 2.2 KB
/
docker-hub.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
---
name: Publish Container image to DockerHub
on:
push:
branches:
- 'master'
paths-ignore:
- '*.md'
permissions:
contents: read
jobs:
docker:
name: Push Docker image to DockerHub
runs-on: ubuntu-latest
permissions:
id-token: write # needed for signing the images with GitHub OIDC Token
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- name: Install cosign
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Log in to DockerHub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Generate data time for docker tag
id: datatime
run: echo "DATETIME=$(date +'%Y%m%d%H%M')" >> "${GITHUB_OUTPUT}"
- name: Build and push
id: docker_build
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: .
push: true
sbom: true
platforms: linux/amd64,linux/arm64
tags: patrickfmarques/network-ups-tools:1.0.0-${{ steps.datatime.outputs.DATETIME }}
- name: Sign the images with GitHub OIDC Token
env:
DIGEST: ${{ steps.docker_build.outputs.digest }}
TAGS: patrickfmarques/network-ups-tools
run: cosign sign --yes "${TAGS}@${DIGEST}"
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}