Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Merge pull request #9 from JupiterOne/pov-390 #6

Merge pull request #9 from JupiterOne/pov-390

Merge pull request #9 from JupiterOne/pov-390 #6

Workflow file for this run

name: Build and Package
on:
push:
tags: '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Cosign
uses: sigstore/cosign-installer@v3
- name: Lowercase the repo name
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
# Login against a Docker registry
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# tags: type=sha,format=long
# Build and push Docker image
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Sign the Docker image (Using OIDC Token for "keyless signing")
# https://github.com/sigstore/cosign-installer
- name: Sign the images with GH OIDC Token
run:
COSIGN_REPOSITORY=ghcr.io/${{ env.REPO }}-signatures cosign sign -y
ghcr.io/${{ env.REPO }}@${{ steps.build-and-push.outputs.DIGEST }}