47
47
if-no-files-found : ignore
48
48
49
49
merge :
50
+ env :
51
+ PRIMARY_KEY : ${{ secrets.GPG_KEY3 }}
52
+ SECONDARY_KEY : ${{ secrets.GPG_KEY4 }}
50
53
name : " Merge artifacts and publish"
51
54
needs : build-debs
52
55
runs-on : ubuntu-latest
@@ -65,12 +68,28 @@ jobs:
65
68
run : |
66
69
sudo apt-get update
67
70
sudo apt-get install -y reprepro
68
- - name : Import GPG key
69
- id : import_gpg
71
+ - name : Import PRIMARY GPG key
72
+ id : import_gpg_primary
73
+ if : env.PRIMARY_KEY != ''
70
74
uses : crazy-max/ghaction-import-gpg@v6
71
75
with :
72
- gpg_private_key : ${{ secrets.GPG_KEY1 }}
73
- passphrase : ${{ secrets.GPG_PASSPHRASE1 }}
76
+ gpg_private_key : ${{ env.PRIMARY_KEY }}
77
+ - name : Import SECONDARY GPG key
78
+ id : import_gpg_secondary
79
+ if : env.SECONDARY_KEY != ''
80
+ uses : crazy-max/ghaction-import-gpg@v6
81
+ with :
82
+ gpg_private_key : ${{ env.SECONDARY_KEY }}
83
+ - name : Generate GPG_PARAMETERS array
84
+ id : build_gpg_parameters
85
+ env :
86
+ FPR_PRIMARY : ${{ steps.import_gpg_primary.outputs.fingerprint }}
87
+ FPR_SECONDARY : ${{ steps.import_gpg_secondary.outputs.fingerprint }}
88
+ run : |
89
+ GPG_PARAMETERS="--yes --armor"
90
+ [ -n "$FPR_PRIMARY" ] && GPG_PARAMETERS+=" -u $FPR_PRIMARY"
91
+ [ -n "$FPR_SECONDARY" ] && GPG_PARAMETERS+=" -u $FPR_SECONDARY"
92
+ echo "GPG_PARAMETERS=$GPG_PARAMETERS" >> "$GITHUB_ENV"
74
93
- name : Create distribution repository and commit to data branch
75
94
run : |
76
95
git checkout --orphan data
79
98
git config --global user.email "[email protected] "
80
99
for file in debian/artifacts/*.changes; do reprepro -b debian/artifacts include current $file;done
81
100
reprepro -b debian/artifacts export
101
+ echo "Sign repo with multiple keys"
102
+ find "debian/artifacts/dists" -type f -name Release | while read -r release_file; do
103
+ local distro_path
104
+ distro_path="$(dirname "$release_file")"
105
+ echo "Signing release at: $distro_path"
106
+ gpg ${{ env.GPG_PARAMETERS }} --clear-sign -o "$distro_path/InRelease" "$release_file"
107
+ gpg ${{ env.GPG_PARAMETERS }} --detach-sign -o "$distro_path/Release.gpg" "$release_file"
108
+ done
82
109
git add debian/artifacts/{pool,dists}
83
110
git diff --cached --quiet || git commit --allow-empty -m "Update published repository files"
84
111
git push --force --set-upstream origin data
0 commit comments