Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(release): sign commits created by release actor #16

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/conventional-commit-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ on:
value: ${{ jobs.release.outputs.major_tag }}
secrets:
RELEASE_TOKEN:
description: Github PAT used for executing the release-please action. Only required for default branch builds.
description: Github PAT used for executing the release-please action. Only required on push events to the default branch.
required: false
RELEASE_ACTOR_GPG_PRIVATE_KEY:
description: GPG Private key associated with the release actor. Used to ensure that commits are signed. Only required on push events to the default branch.
required: false
RELEASE_ACTOR_GPG_PASSPHRASE:
description: Passphrase to unlock the use the GPG Key passed in `RELEASE_ACTOR_GPG_PRIVATE_KEY`. Used to ensure that commits are signed. Only required on push events to the default branch.
required: false

permissions:
Expand Down Expand Up @@ -231,6 +237,34 @@ jobs:
extra-files: ${{ inputs.extra_files }}
token: ${{ secrets.RELEASE_TOKEN }}


- name: Checkout Release Branch
if: ${{ steps.release.outputs.pr != '' }}
id: checkout-release-branch
uses: actions/[email protected]
with:
ref: ${{ fromJson(steps.release.outputs.pr).headBranchName }}
fetch-depth: 0

- name: Import GPG key
id: key-import
if: ${{ steps.checkout-release-branch.conclusion == 'success' }}
uses: crazy-max/[email protected]
with:
gpg_private_key: ${{ secrets.RELEASE_ACTOR_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.RELEASE_ACTOR_GPG_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true

- name: Amend the PR commit to sign it
if: ${{ steps.key-import.conclusion == 'success' }}
run: |-
git config --global user.name "${{ steps.key-import.outputs.name }}"
git config --global user.email "${{ steps.key-import.outputs.email }}"
git commit --amend --no-edit -S
git push --force

- name: Create additional tags
if: steps.release.outputs.release_created
id: additional_tags
Expand Down
Loading