Skip to content

Commit

Permalink
add signing commits to workflows and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
CezaryKierzyk committed Nov 27, 2024
1 parent 91f3409 commit 03e8acb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/_branchpreview-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:
argo-sync-user-token: ${{ secrets.ARGO_SYNC_USER_TOKEN }}
git-commit-author: ${{ secrets.AUTOCOMMIT_AUTHOR }}
git-commit-email: ${{ secrets.AUTOCOMMIT_EMAIL }}
git-commit-gpg-key-b64: ${{ secrets.AUTOCOMMIT_GPG_KEY_B64 }}
git-commit-gpg-key-fingerprint: ${{ secrets.AUTOCOMMIT_GPG_KEY_FINGERPRINT }}
hard-refresh: 'true'
post-frontend-url: '${{ inputs.post-frontend-url }}'
pull-request-number: '${{ inputs.pull-request-number }}'
2 changes: 2 additions & 0 deletions .github/workflows/_branchpreview-delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ jobs:
argo-sync-user-token: ${{ secrets.ARGO_SYNC_USER_TOKEN }}
git-commit-author: ${{ secrets.AUTOCOMMIT_AUTHOR }}
git-commit-email: ${{ secrets.AUTOCOMMIT_EMAIL }}
git-commit-gpg-key-b64: ${{ secrets.AUTOCOMMIT_GPG_KEY_B64 }}
git-commit-gpg-key-fingerprint: ${{ secrets.AUTOCOMMIT_GPG_KEY_FINGERPRINT }}
17 changes: 17 additions & 0 deletions create-branchpreview/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ inputs:
git-commit-email:
description: 'Git commit email when pushing to branchpreviews repository'
required: true
git-commit-gpg-key-b64:
description: base64 encoded signing key
required: true
git-commit-gpg-key-fingerprint:
description: fingerprint of gpg key
required: true
image:
description: 'Full docker image in format of host/repo:tag'
required: true
Expand Down Expand Up @@ -118,11 +124,22 @@ runs:
echo "all-base64=${all_base64}" >> $GITHUB_OUTPUT
# yamllint enable rule:line-length

- name: Configure signing key
shell: bash
# yamllint disable rule:line-length
run: |
echo ${{ inputs.git-commit-gpg-key-b64 }} | base64 -d > key.gpg
gpg --import key.gpg
rm key.gpg
git config --global user.signingkey $(echo ${{ inputs.git-commit-gpg-key-fingerprint }} | tail -c 17)
# yamllint enable rule:line-length

- name: Commit branchpreview change
uses: EndBug/add-and-commit@v9.1.1
with:
author_name: '${{ inputs.git-commit-author }}'
author_email: '${{ inputs.git-commit-email }}'
commit: -S
# yamllint disable-line rule:line-length
message: 'Upsert ${{ inputs.repository-name }}:${{ inputs.branch-name }} with image tag: ${{ steps.start-branchpreview.outputs.image-tag }}'
add: '["*.yaml","*.txt"]'
Expand Down
16 changes: 16 additions & 0 deletions delete-branchpreview/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ inputs:
git-commit-email:
description: 'Git commit email when pushing to branchpreviews repository'
required: true
git-commit-gpg-key-b64:
description: base64 encoded signing key
required: true
git-commit-gpg-key-fingerprint:
description: fingerprint of gpg key
required: true

runs:
using: "composite"
Expand Down Expand Up @@ -79,6 +85,16 @@ runs:
'${{ inputs.repository-name }}' \
'${{ inputs.branch-name }}'
- name: Configure signing key
shell: bash
# yamllint disable rule:line-length
run: |
echo ${{ inputs.git-commit-gpg-key-b64 }} | base64 -d > key.gpg
gpg --import key.gpg
rm key.gpg
git config --global user.signingkey $(echo ${{ inputs.git-commit-gpg-key-fingerprint }} | tail -c 17)
# yamllint enable rule:line-length

- name: Commit deletion of the branchpreview
uses: EndBug/add-and-commit@v9.1.1
with:
Expand Down

0 comments on commit 03e8acb

Please sign in to comment.