Skip to content

Commit

Permalink
Added Cosign
Browse files Browse the repository at this point in the history
  • Loading branch information
DazWilkin committed Jun 27, 2023
1 parent 8b2c627 commit 9408417
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
42 changes: 22 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ jobs:
env:
REPO: dazwilkin/koyeb-exporter
steps:
- name: Checkout
- name: checkout
uses: actions/checkout@v3
- name: Setup
- name: setup
uses: docker/setup-buildx-action@v2
- name: Login
- name: login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR }}
- name: Get kernel version
- name: get-version
run: echo "VERSION=$(uname --kernel-release)" >> ${GITHUB_ENV}
- name: build-push
- name: docker-build-push
id: docker-build-push
uses: docker/build-push-action@v4
with:
context: .
Expand All @@ -34,21 +35,22 @@ jobs:
COMMIT=${{ github.sha }}
tags: ghcr.io/${{ env.REPO }}:${{ github.sha }}
push: true
# - name: Sigstore installer
# uses: sigstore/cosign-installer@main
# - name: Write signing key to disk (only needed for `cosign sign --key`)
# run: echo "${{ secrets.SIGNING }}" > ./cosign.key
# - name: Sign container image
# run: |
# cosign sign \
# --key=./cosign.key \
# --annotations="repo=${{ github.repository }}" \
# --annotations="workflow=${{ github.workflow }}" \
# --annotations="commit=${{ github.sha }}" \
# --annotations="version=${{ env.VERSION }}" \
# ghcr.io/${{ env.REPO }}:${{ github.sha }}
# env:
# COSIGN_PASSWORD: ""
- name: install-cosign
uses: sigstore/cosign-installer@main
- name: write-key
run: echo "${{ secrets.SIGNING }}" > ./cosign.key
- name: sign-image
run: |
cosign sign \
--yes \
--key=./cosign.key \
--annotations="repo=${{ github.repository }}" \
--annotations="workflow=${{ github.workflow }}" \
--annotations="commit=${{ github.sha }}" \
--annotations="version=${{ env.VERSION }}" \
ghcr.io/${{ env.REPO }}@${{ steps.docker-build-push.outputs.digest }}
env:
COSIGN_PASSWORD: ""
# - name: Revise occurrences of the image
# run: |
# git config --local user.email "action@github.com"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Cosign private key
cosign.key
4 changes: 4 additions & 0 deletions cosign.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEZQFexW07am2f7/J8YixsYxRF9m+h
oN5o7SBm4Xv20ZuYajFX5DPFGmnf90+OdOhu5R/a5uiYe0+cHbeawS2kOg==
-----END PUBLIC KEY-----

0 comments on commit 9408417

Please sign in to comment.