Skip to content

ci: Use cosign to sign container images. #33

ci: Use cosign to sign container images.

ci: Use cosign to sign container images. #33

Workflow file for this run

name: Create and publish a api image
on: push
env:
REGISTRY: ghcr.io/metal-toolbox
API_IMAGE_NAME: audito-maldito/audito-maldito
jobs:
auto-release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@1f401f745bf57e30b3a2800ad308a87d2ebdf14b
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: sigstore/cosign-installer@main
- name: Get current date
id: date
run: echo "::set-output name=date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Extract metadata (tags, labels) for Docker
id: meta-api
uses: docker/metadata-action@62339db73c56dd749060f65a6ebb93a6e056b755
with:
images: ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }}
- name: Build rsyslog and push Docker image
id: rsyslog-build-push
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
context: "./contrib/rsyslog"
push: true
file: ./contrib/rsyslog/Dockerfile.ubuntu
tags: ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }}:${{ github.ref_name }}-rsyslog
labels: ${{ steps.meta-api.outputs.labels }}
- run: cosign sign -y -r ${TAGS}
env:
TAGS: ${{needs.rsyslog-build-push.outputs.tags}}
- name: Build and push Docker image
id: am-build-push
uses: docker/build-push-action@fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2
with:
push: true
file: Dockerfile
tags: ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }}:${{ github.ref_name }}
labels: ${{ steps.meta-api.outputs.labels }}
- run: cosign sign -y -r ${TAGS}
env:
TAGS: ${{needs.am-build-push.outputs.tags}}