Skip to content

Commit

Permalink
Sign commit with GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
DFolchA committed Jul 21, 2023
1 parent 2c316a4 commit 589eaec
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:
description: 'Base branch to create the PR'
required: true
version:
description: 'Version to bump to'
description: 'Version to bump to. Format: x.x.x.'
required: true
revision:
description: 'Revision to bump to. Defalut: 1'
description: 'Revision to bump to. Default: 1'
required: false
date:
description: 'Date to bump to. Format: m-d-Y. Default: today'
Expand Down Expand Up @@ -39,7 +39,17 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: bump-version-${{ github.event.inputs.version }}


- name: Import bot's GPG key for signing commits
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.WAZUHCI_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.WAZUHCI_GPG_PASSWORD }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true

- name: Set execution parameters
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
Expand All @@ -60,12 +70,16 @@ jobs:

- name: "Commit changes and push"
run: |
git config --global user.name "wazuhci"
git config --global user.email "wazuhci@wazuh.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add .
git commit -m "Bump version to ${{ github.event.inputs.version }}"
git push origin bump-version-${{ github.event.inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }}
GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }}
GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }}
shell: bash

- name: "Create pull request"
Expand Down

0 comments on commit 589eaec

Please sign in to comment.