Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Cmiel <[email protected]>
  • Loading branch information
chmeliik committed Jun 12, 2024
1 parent 017c7bf commit 5012b12
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/push-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token
name: Build Image
on:
push:
branches:
- main
tags:
- image/v*
pull_request:

env:
REGISTRY: ghcr.io
SCOPED_NAME: ${{ github.repository_owner }}/checkton
IMAGE: ${{ env.REGISTRY }}/${{ env.SCOPED_NAME }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
attestations: write
packages: write
contents: read

steps:
- uses: actions/checkout@v4

- name: Build image
uses: redhat-actions/buildah-build@v2
with:
containerfiles: Dockerfile
image: ${{ env.IMAGE }}
tags: |
latest
test
- name: Generate SBOM
uses: anchore/sbom-action@v0
with:
image: ${{ env.IMAGE }}
format: cyclonedx-json
output-file: .sbom.json
upload-artifact: false
upload-release-assets: false

- name: Login to registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push image
id: push
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.REGISTRY }}
image: ${{ env.SCOPED_NAME }}
tags: test

# version=""
# if [[ "$GITHUB_REF" == refs/tags/image/v*.*.* ]]; then
# version=$(basename "$GITHUB_REF")
# fi

# podman tag "$IMAGE:latest" "$IMAGE:$GITHUB_SHA"
# podman tag "$IMAGE:latest" "$IMAGE:test"
# podman push "$IMAGE:test"
# # podman push "$IMAGE:$GITHUB_SHA"
# # if [[ -n "$version" ]]; then
# # skopeo copy "$IMAGE:$GITHUB_SHA" "$IMAGE:$version"
# # fi

- name: Generate image attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.IMAGE }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

- name: Generate SBOM attestation
uses: actions/attest-sbom@v1
with:
subject-name: ${{ env.IMAGE }}
subject-digest: ${{ steps.push.outputs.digest }}
sbom-path: .sbom.json
push-to-registry: true

# - name: Tag with release version
# if: true

0 comments on commit 5012b12

Please sign in to comment.