Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
docker
/
metadata-action
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Security
Insights
Additional navigation options
Code
Pull requests
Actions
Security
Insights
Files
b944796
.github
ISSUE_TEMPLATE
workflows
ci.yml
test.yml
validate.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
SECURITY.md
dependabot.yml
metadata-action.png
__mocks__
__tests__
dist
src
test
.dockerignore
.editorconfig
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
.prettierrc.json
LICENSE
README.md
UPGRADE.md
action.yml
codecov.yml
dev.Dockerfile
docker-bake.hcl
jest.config.ts
package.json
tsconfig.json
yarn.lock
Breadcrumbs
metadata-action
/
.github
/
workflows
/
ci.yml
View Runs
Blame
Blame
Latest commit
History
History
385 lines (369 loc) · 9.42 KB
Breadcrumbs
metadata-action
/
.github
/
workflows
/
ci.yml
Top
File metadata and controls
Code
Blame
385 lines (369 loc) · 9.42 KB
Raw
name: ci concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: schedule: - cron: '0 10 * * *' push: branches: - 'master' - 'releases/v*' tags: - 'v*.*.*' pull_request: env: DOCKER_IMAGE: localhost:5000/name/app jobs: multi-images: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app tags: | type=schedule type=ref,event=branch type=ref,event=tag type=ref,event=pr type=sha - name: Print envs run: env|sort tag-schedule: runs-on: ubuntu-latest strategy: fail-fast: false matrix: tag-schedule: - "" - "cron-{{date 'YYYYMMDD'}}" - "{{date 'YYYYMMDD-HHmmss'}}" - "schedule" steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app tags: | type=schedule,pattern=${{ matrix.tag-schedule }} type=ref,event=branch type=ref,event=tag type=ref,event=pr type=sha tag-match: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - tag-match: '\d.\d.\d' tag-match-group: '0' - tag-match: '\d.\d' tag-match-group: '0' - tag-match: 'v(.*)' tag-match-group: '1' steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app tags: | type=schedule type=ref,event=branch type=ref,event=tag type=ref,event=pr type=match,"pattern=${{ matrix.tag-match }}",group=${{ matrix.tag-match-group }} type=sha tag-semver: runs-on: ubuntu-latest strategy: fail-fast: false matrix: flavor-latest: - "auto" - "true" - "false" steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app tags: | type=schedule type=ref,event=branch type=ref,event=tag type=ref,event=pr type=semver,pattern={{raw}} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}}.{{patch}} type=sha flavor: | latest=${{ matrix.flavor-latest }} flavor: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app flavor: | prefix=foo- suffix=-bar images: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta uses: ./ with: images: | name=${{ env.DOCKER_IMAGE }} name=ghcr.io/name/app,enable=${{ github.event_name == 'pull_request' }} name=ghcr.io/name/release,enable=${{ startsWith(github.ref, 'refs/tags/') }} labels: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app labels: | maintainer=CrazyMax org.opencontainers.image.title=MyCustomTitle org.opencontainers.image.description=this is a "good" example org.opencontainers.image.vendor=MyCompany global-exps: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app tags: | type=sha type=raw,value=gexp-branch-{{branch}} type=raw,value=gexp-date-{{date 'YYYYMMDD'}} type=raw,value=gexp-tag-{{tag}} type=raw,value=gexp-baseref-{{base_ref}} type=raw,value=gexp-defbranch,enable={{is_default_branch}} json: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta id: meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app labels: | maintainer=CrazyMax - name: JSON output run: | echo "maintainer=${{ fromJSON(steps.meta.outputs.json).labels['maintainer'] }}" echo "version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" echo "revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}" echo "created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}" docker-push: runs-on: ubuntu-latest services: registry: image: registry:2 ports: - 5000:5000 steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta id: docker_meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} tags: | type=schedule type=ref,event=branch type=ref,event=tag type=ref,event=pr type=semver,pattern=v{{version}} type=semver,pattern=v{{major}}.{{minor}} type=semver,pattern=v{{major}} type=sha - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: driver-opts: network=host - name: Build and push to local registry uses: docker/build-push-action@v5 with: context: ./test file: ./test/Dockerfile platforms: linux/amd64,linux/arm64,linux/386 push: true tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} - name: Inspect image run: | docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} - name: Check manifest run: | docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} - name: Dump context if: always() uses: crazy-max/ghaction-dump-context@v2 bake: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta id: docker_meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app tags: | type=schedule type=ref,event=branch type=ref,event=tag type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build uses: docker/bake-action@v4 with: files: | ./test/docker-bake.hcl ${{ steps.docker_meta.outputs.bake-file-tags }} ${{ steps.docker_meta.outputs.bake-file-labels }} targets: | release sep-tags: runs-on: ubuntu-latest strategy: fail-fast: false matrix: sep: - " " - "," steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta id: meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app sep-tags: ${{ matrix.sep }} - name: Tags uses: actions/github-script@v6 with: script: | console.log(`${{ steps.meta.outputs.tags }}`); output-env: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Docker meta id: meta uses: ./ with: images: | ${{ env.DOCKER_IMAGE }} ghcr.io/name/app labels: | maintainer=CrazyMax - name: Build uses: docker/build-push-action@v5 with: context: ./test file: ./test/output.Dockerfile build-args: | DOCKER_METADATA_OUTPUT_VERSION DOCKER_METADATA_OUTPUT_TAGS DOCKER_METADATA_OUTPUT_LABELS DOCKER_METADATA_OUTPUT_JSON
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
You can’t perform that action at this time.