-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
224 lines (192 loc) · 7.69 KB
/
action.yaml
File metadata and controls
224 lines (192 loc) · 7.69 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
---
name: 'NFC Docker'
description: Docker workflow
inputs:
DOCKER_BUILD_REGISTRY:
default: "ghcr.io"
description: Registry where build image will live
required: false
# type: string
DOCKER_BUILD_IMAGE_NAME:
default: "${{ github.repository }}"
description: Docker image name for building image
required: false
# type: string
DOCKER_BUILD_IMAGE_TAG:
default: "${{ github.sha }}"
description: Docker image tag for building image
required: false
# type: string
DOCKER_FILE:
default: "dockerfile"
description: Path to the dockerfile
required: false
# type: string
DOCKER_LABEL_ARTIFACTHUB_MAINTAINER:
default: '[{"name":"No Fuss Computing","email":"helpdesk@nofusscomputing.com"}]'
description: Artifact hub Maintainer
required: false
# type: string
DOCKER_LABEL_ARTIFACTHUB_README:
default: 'https://raw.githubusercontent.com/${{ github.repository }}/development/README.md'
description: Artifact hub ReadMe
required: false
# type: string
DOCKER_PUBLISH_REGISTRY:
default: "docker.io"
description: Registry where image will be published to
required: false
# type: string
DOCKER_PUBLISH_IMAGE_NAME:
default: "${{ github.repository }}"
description: Docker image name for publishing the image
required: false
# type: string
DOCKER_SCAN_IMAGE_VULNERABILITY:
default: 'true'
description: Scan Image with Trivy
required: false
# type: boolean
DOCKER_TAG_IMAGE_TAG_SOURCE:
default: "${{ github.sha }}"
description: Docker image tag Used for source Image to tag
required: false
# type: string
DOCKER_TAG_IMAGE_TAG_LATEST:
default: 'true'
description: Create image with tag 'Latest'
required: false
# type: boolean
DOCKER_TAG_IMAGE_TAG_SHA:
default: 'true'
description: Create image with tag that is the git commit
required: false
# type: boolean
# permissions:
# pull-requests: write
# contents: write
# actions: read
# checks: write
# packages: write
# security-events: write
# statuses: write
# id-token: write
# attestations: write
runs:
using: "composite"
steps:
# docker-build:
# - if:
# (${{
# github.event.push
# ||
# github.ref_type == 'tag'
# }})
# # runs-on: ubuntu-latest
# name: Build Image
# # outputs:
# # build-image-digest: ${{ steps.image-digest.outputs.value-out }}
# steps:
- name: Docker
uses: nofusscomputing/scratchpad/.github/workflows/docker.yaml@development
# - name: Debug
# shell: bash
# run: |
# echo "${{ github.event.pull_request.head.repo.full_name || github.repository }}";
# echo "**************************";
# echo "${{ github.event.pull_request.head.repo.full_name }}";
# echo "**************************";
# echo "${{ github.repository }}";
# echo "**************************";
# echo "${{ github.event.pull_request.head.repo }}";
# echo "**************************";
# echo "${{ github.event.push }}";
# echo "**************************";
# - uses: actions/checkout@v4
# - name: Dummy Task
# shell: bash
# if: ${{ github.ref_type == 'tag' }}
# run: |
# echo "This Job does nothing however as 'docker-build' is a dependency job, must do something.";
# - name: Log into registry ghcr.io
# uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Setup BuildX
# shell: bash
# if: ${{ github.ref_type != 'tag' }}
# run: |
# docker buildx create --name project-v3-builder;
# docker buildx use project-v3-builder;
# - name: build image
# shell: bash
# if: ${{ github.ref_type != 'tag' }}
# run: |
# docker buildx build --platform="linux/amd64,linux/arm64" . \
# --label "org.opencontainers.image.created=$(date '+%Y-%m-%dT%H:%M:%S%:z')" \
# --label "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
# --label "org.opencontainers.image.revision=${{ github.sha }}" \
# \
# --label "io.artifacthub.package.readme-url=${{ inputs.DOCKER_LABEL_ARTIFACTHUB_README }}" \
# --label 'io.artifacthub.package.maintainers=${{ inputs.DOCKER_LABEL_ARTIFACTHUB_MAINTAINER }}' \
# \
# --annotation "org.opencontainers.image.description=a DESCRIPTION for multi-arch images" \
# --annotation "org.opencontainers.image.created=$(date '+%Y-%m-%dT%H:%M:%S%:z')" \
# --annotation "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
# --annotation "org.opencontainers.image.revision=${{ github.sha }}" \
# --push \
# --file ${{ inputs.DOCKER_FILE }} \
# --tag ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_BUILD_IMAGE_TAG }};
# - name: Remove "Unknown" Image from Manifest
# shell: bash
# if: ${{ github.ref_type != 'tag' }}
# run: |
# DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_BUILD_IMAGE_TAG }}" --format "{{ range .Manifest.Manifests }}{{ if ne (print .Platform) \"&{unknown unknown [] }\" }}${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_BUILD_IMAGE_TAG }}@{{ println .Digest }}{{end}} {{end}}");
# docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES \
# --tag ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_BUILD_IMAGE_TAG }} \
# --tag ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:dev;
# - name: Fetch image
# shell: bash
# run: |
# docker pull ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_BUILD_IMAGE_TAG }} >> /dev/null;
# - name: Fetch Manifest digest
# shell: bash
# id: image-digest
# run: |
# echo "value-out=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}:${{ inputs.DOCKER_BUILD_IMAGE_TAG }} | cut -d '@' -f 2)" >> $GITHUB_OUTPUT
# - name: Attest
# if: ${{
# github.ref_name == 'development'
# ||
# github.ref_name == 'master'
# ||
# github.ref_type == 'tag'
# }}
# uses: actions/attest-build-provenance@v1
# id: image-attest
# with:
# subject-name: ${{ inputs.DOCKER_BUILD_REGISTRY }}/${{ inputs.DOCKER_BUILD_IMAGE_NAME }}
# subject-digest: ${{ steps.image-digest.outputs.value-out }}
# push-to-registry: true
# - name: Upload Image Attestation Artifact
# if: ${{
# github.ref_name == 'development'
# ||
# github.ref_name == 'master'
# ||
# github.ref_type == 'tag'
# }}
# uses: actions/upload-artifact@v4
# with:
# name: ${{ inputs.DOCKER_BUILD_REGISTRY }}-attestation-image
# path: ${{ steps.image-attest.outputs.bundle-path }}
# - name: Cleanup BuildX
# shell: bash
# if: ${{ github.ref_type != 'tag' }}
# run: |
# docker buildx rm project-v3-builder;
branding:
icon: 'activity'
color: 'blue'