Skip to content

Commit 9111639

Browse files
committed
ign with multiple keys: import three keys at once
1 parent c216a42 commit 9111639

File tree

1 file changed

+73
-17
lines changed

1 file changed

+73
-17
lines changed

.github/workflows/pack-debian.yml

Lines changed: 73 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,32 @@ on:
3636
type: string
3737

3838
secrets:
39-
GPG_PRIVATE_KEY:
40-
required: true
41-
PASSPHRASE:
42-
required: true
43-
SSH_KEY_TORRENTS:
39+
PRIMARY_KEY:
40+
required: false
41+
PRIMARY_PASS:
42+
required: false
43+
SECONDARY_KEY:
44+
required: false
45+
SECONDARY_PASS:
4446
required: false
45-
KNOWN_HOSTS_UPLOAD:
47+
TERTIARY_KEY:
4648
required: false
49+
TERTIARY_PASS:
50+
required: false
51+
52+
env:
53+
PRIMARY_KEY: ${{ secrets.PRIMARY_KEY }}
54+
PRIMARY_PASS: ${{ secrets.PRIMARY_PASS }}
55+
SECONDARY_KEY: ${{ secrets.SECONDARY_KEY }}
56+
SECONDARY_PASS: ${{ secrets.SECONDARY_PASS }}
57+
TERTIARY_KEY: ${{ secrets.TERTIARY_KEY }}
58+
TERTIARY_PASS: ${{ secrets.TERTIARY_PASS }}
4759

4860
jobs:
4961

5062
prepare:
63+
name: Prepare releases
64+
if: ${{ github.repository_owner == 'Armbian' }}
5165
runs-on: ubuntu-latest
5266
outputs:
5367
matrix: ${{ steps.prep.outputs.matrix }}
@@ -178,23 +192,49 @@ jobs:
178192
path: repository
179193
ref: repository
180194

181-
- name: Import GPG key
182-
id: import_gpg
195+
- name: Import PRIMARY GPG key
196+
id: import_gpg_primary
197+
if: env.PRIMARY_KEY != ''
198+
uses: crazy-max/ghaction-import-gpg@v6
199+
with:
200+
gpg_private_key: ${{ secrets.PRIMARY_KEY }}
201+
passphrase: ${{ secrets.PRIMARY_PASS || '' }}
202+
203+
- name: Import SECONDARY GPG key
204+
id: import_gpg_secondary
205+
if: env.SECONDARY_KEY != ''
183206
uses: crazy-max/ghaction-import-gpg@v6
184207
with:
185-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
186-
passphrase: ${{ secrets.PASSPHRASE }}
208+
gpg_private_key: ${{ secrets.SECONDARY_KEY }}
209+
passphrase: ${{ secrets.SECONDARY_PASS || '' }}
210+
211+
- name: Import TERTIARY GPG key
212+
id: import_gpg_tertiary
213+
if: env.TERTIARY_KEY != ''
214+
uses: crazy-max/ghaction-import-gpg@v6
215+
with:
216+
gpg_private_key: ${{ secrets.TERTIARY_KEY }}
217+
passphrase: ${{ secrets.TERTIARY_PASS || '' }}
218+
219+
- name: Add fingerprint to summary
220+
if: env.TERTIARY_KEY != ''
221+
run: |
222+
echo "### 🔐 TERTIARY GPG Key Info" >> $GITHUB_STEP_SUMMARY
223+
echo "- Fingerprint: \`${{ steps.import_gpg_tertiary.outputs.fingerprint }}\`" >> $GITHUB_STEP_SUMMARY
224+
echo "- Key ID: \`${{ steps.import_gpg_tertiary.outputs.keyid }}\`" >> $GITHUB_STEP_SUMMARY
225+
echo "- User: \`${{ steps.import_gpg_tertiary.outputs.name }} <${{ steps.import_gpg_tertiary.outputs.email }}>\`" >> $GITHUB_STEP_SUMMARY
187226
188227
- name: Configure git identity
189228
working-directory: repository
229+
env:
230+
GPG_TTY: ${{ env.GPG_TTY || '/dev/tty' }}
190231
run: |
191232
192-
echo "Testing signing" | gpg --sign --armor
193-
194-
gpg -K
195-
echo "#"
196-
git config user.name github-actions
197-
git config user.email github-actions@github.com
233+
echo "Available GPG keys:" >> $GITHUB_STEP_SUMMARY
234+
gpg --list-secret-keys --keyid-format LONG >> $GITHUB_STEP_SUMMARY
235+
#cho "data" | gpg --armor --batch --yes --local-user DF00FAF1C577104B50BF1D0093D6889F9F0E78D5 --sign # need password
236+
# echo "data" | gpg --armor --batch --yes --local-user B4A41B81566CC20009232FE45CD410F6B3CBB6BB --sign # need password
237+
#cho "data" | gpg --armor --batch --yes --local-user 8CFA83D13EB2181EEF5843E41EB30FAF236099FE --sign
198238
199239
- name: Deploy packages
200240
run: |
@@ -214,7 +254,6 @@ jobs:
214254
Architectures: amd64 arm64 armhf riscv64
215255
Components: main
216256
Description: Armbian development repo
217-
SignWith: DF00FAF1C577104B50BF1D0093D6889F9F0E78D5
218257
EOD
219258
220259
# Determine a list of binary debs to include in the repo
@@ -242,7 +281,24 @@ jobs:
242281
echo "Repository generated at ${REPO_DIR}/"
243282
fi
244283
284+
echo "Sign repo"
285+
GPG_PARAMETERS=(
286+
"--yes"
287+
"--armor"
288+
"-u" "DF00FAF1C577104B50BF1D0093D6889F9F0E78D5" # Igor Pecovnik (Ljubljana, Slovenia) <igor.pecovnik@gmail.com>
289+
"-u" "8CFA83D13EB2181EEF5843E41EB30FAF236099FE" # Armbian Repository Signing Key (Repository Key) <info@armbian.com>
290+
)
291+
for i in ${REPO_DIR}/dists/*/Release
292+
do
293+
DISTRO_PATH="$(dirname "$i")"
294+
echo $DISTRO_PATH
295+
gpg "${GPG_PARAMETERS[@]}" --clear-sign -o "$DISTRO_PATH/InRelease" "$i"
296+
gpg "${GPG_PARAMETERS[@]}" --detach-sign -o "$DISTRO_PATH/Release.gpg" "$i"
297+
done
298+
245299
cd ${REPO_DIR}
300+
git config user.name "github-actions"
301+
git config user.email "github-actions@github.com"
246302
git add .
247303
git commit -m "Updating repo" || true
248304
git push origin repository || true

0 commit comments

Comments
 (0)