|
14 | 14 | default: ''
|
15 | 15 | required: false
|
16 | 16 | type: string
|
| 17 | + sign-commits: |
| 18 | + description: 'Enable GPG commit signing' |
| 19 | + default: false |
| 20 | + required: false |
| 21 | + type: boolean |
17 | 22 |
|
18 | 23 | secrets:
|
19 | 24 | NIX_GITHUB_TOKEN:
|
|
31 | 36 | CREATE_PR_APP_PRIVATE_KEY:
|
32 | 37 | description: Private key of the GitHub App used for opening pull requests.
|
33 | 38 | required: true
|
| 39 | + GIT_GPG_SIGNING_SECRET_KEY: |
| 40 | + description: GPG secret key used to sign commits |
| 41 | + required: false |
| 42 | + GIT_GPG_SIGNING_PASSPHRASE: |
| 43 | + description: GPG passphrase for secret key |
| 44 | + required: false |
34 | 45 |
|
35 | 46 | outputs:
|
36 | 47 | pr-url:
|
@@ -61,13 +72,35 @@ jobs:
|
61 | 72 | trusted-public-keys: ${{ vars.TRUSTED_PUBLIC_KEYS }}
|
62 | 73 | substituters: ${{ vars.SUBSTITUTERS }}
|
63 | 74 |
|
| 75 | + - name: Configure Git credentials |
| 76 | + run: | |
| 77 | + git config --local user.name "${{ vars.GIT_USER_NAME }}" |
| 78 | + git config --local user.email "${{ vars.GIT_USER_EMAIL }}" |
| 79 | + git config --local commit.gpgsign ${{ inputs.sign-commits }} |
| 80 | +
|
| 81 | + - name: Import GPG key with passphrase |
| 82 | + if: ${{ inputs.sign-commits }} |
| 83 | + env: |
| 84 | + GIT_GPG_SIGNING_SECRET_KEY: ${{ secrets.GIT_GPG_SIGNING_SECRET_KEY }} |
| 85 | + GIT_GPG_SIGNING_PASSPHRASE: ${{ secrets.GIT_GPG_SIGNING_PASSPHRASE }} |
| 86 | + run: | |
| 87 | + echo "$GIT_GPG_SIGNING_SECRET_KEY" \ |
| 88 | + | gpg --batch --yes \ |
| 89 | + --pinentry-mode loopback \ |
| 90 | + --passphrase "$GIT_GPG_SIGNING_PASSPHRASE" \ |
| 91 | + --import |
| 92 | + git config --local user.signingkey "${{ vars.GIT_GPG_SIGNING_KEY_ID }}" |
| 93 | +
|
64 | 94 | - name: Run `nix flake update`
|
65 | 95 | id: update-lockfile
|
66 | 96 | run: |
|
67 | 97 | curl -fsSL --proto '=https' --tlsv1.2 \
|
68 | 98 | https://raw.githubusercontent.com/metacraft-labs/nixos-modules/main/scripts/commit_flake_update.bash \
|
69 |
| - -o commit_flake_update.bash |
70 |
| - FLAKE_INPUT=${{ inputs.flake-input }} bash commit_flake_update.bash |
| 99 | + -o commit_flake_update.bash && \ |
| 100 | + bash commit_flake_update.bash |
| 101 | + env: |
| 102 | + GITHUB_TOKEN: ${{ github.token }} |
| 103 | + FLAKE_INPUT: ${{ inputs.flake-input }} |
71 | 104 |
|
72 | 105 |
|
73 | 106 | id: generate-token
|
|
0 commit comments