Merge pull request #21 from containerinfra/renovate/docker-login-acti… #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
env: | |
IMAGE_NAME: ${{ github.event.repository.name }} | |
VERSION: '7.6.0' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up cosign | |
uses: sigstore/cosign-installer@main | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: thojkooi | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: thojkooi | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Verify base image | |
run: | | |
cosign dockerfile verify --base-image-only --certificate-oidc-issuer https://accounts.google.com --certificate-identity [email protected] Dockerfile | |
- name: Publish container image | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
ghcr.io/containerinfra/${{ env.IMAGE_NAME }}:${{ env.VERSION }} | |
docker.io/containerinfra/${{ env.IMAGE_NAME }}:${{ env.VERSION }} | |
build-args: | | |
OAUTH2_PROXY_VERSION=v${{ env.VERSION }} | |
labels: | | |
org.opencontainers.image.title=${{ github.event.repository.name }} | |
org.opencontainers.image.description=${{ github.event.repository.description }} | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.version=${{ env.VERSION }} | |
- name: sign container image | |
run: | | |
echo "$COSIGN_KEY" >> cosign.key | |
cosign sign --key cosign.key -y ghcr.io/containerinfra/${{ env.IMAGE_NAME }}:${{ env.VERSION }} | |
cosign sign --key cosign.key -y docker.io/containerinfra/${{ env.IMAGE_NAME }}:${{ env.VERSION }} | |
shell: bash | |
env: | |
COSIGN_KEY: ${{secrets.COSIGN_KEY}} | |
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}} | |
- name: Check images | |
run: | | |
docker buildx imagetools inspect docker.io/containerinfra/${IMAGE_NAME}:${{ env.VERSION }} | |
docker buildx imagetools inspect ghcr.io/containerinfra/${IMAGE_NAME}:${{ env.VERSION }} | |
docker pull docker.io/containerinfra/${IMAGE_NAME}:${{ env.VERSION }} | |
docker pull ghcr.io/containerinfra/${IMAGE_NAME}:${{ env.VERSION }} | |
cosign verify --key cosign.pub docker.io/containerinfra/${IMAGE_NAME}:${{ env.VERSION }} | |
cosign verify --key cosign.pub ghcr.io/containerinfra/${IMAGE_NAME}:${{ env.VERSION }} | |
- uses: anchore/sbom-action@v0 | |
with: | |
image: ghcr.io/containerinfra/${{ env.IMAGE_NAME }}:${{ env.VERSION }} |