Skip to content

Commit b2ef329

Browse files
Add new workflow to build Docker Images
1 parent f4a6de8 commit b2ef329

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/docker_publish.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build & Publish Docker Images
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
pull_request:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
11+
jobs:
12+
calculate-images-to-build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: "Checkout repository"
16+
uses: actions/checkout@v4
17+
- name: "Calculate changed files directories"
18+
id: calculate_changed_files
19+
uses: tj-actions/changed-files@v44
20+
with:
21+
dir_names: true
22+
dir_names_exclude_current_dir: true
23+
json: true
24+
- name: "Echo out changes"
25+
run: |
26+
echo "${{ steps.calculate_changed_files.all_changed_files }}"
27+
# build-and-push-image:
28+
# runs-on: ubuntu-latest
29+
# # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
30+
# permissions:
31+
# contents: read
32+
# packages: write
33+
# attestations: write
34+
# id-token: write
35+
# #
36+
# steps:
37+
# - name: Checkout repository
38+
# uses: actions/checkout@v4
39+
# # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
40+
# - name: Log in to the Container registry
41+
# uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
42+
# with:
43+
# registry: ${{ env.REGISTRY }}
44+
# username: ${{ github.actor }}
45+
# password: ${{ secrets.GITHUB_TOKEN }}
46+
# # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
47+
# - name: Extract metadata (tags, labels) for Docker
48+
# id: meta
49+
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
50+
# with:
51+
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
# # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
53+
# # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
54+
# # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
55+
# - name: Build and push Docker image
56+
# id: push
57+
# uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
58+
# with:
59+
# context: .
60+
# push: true
61+
# tags: ${{ steps.meta.outputs.tags }}
62+
# labels: ${{ steps.meta.outputs.labels }}
63+
#
64+
# # This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
65+
# - name: Generate artifact attestation
66+
# uses: actions/attest-build-provenance@v1
67+
# with:
68+
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
69+
# subject-digest: ${{ steps.push.outputs.digest }}
70+
# push-to-registry: true
71+

0 commit comments

Comments
 (0)