Skip to content

Commit d5dc7a1

Browse files
Signed rps (#804)
* Sign RPM with gpg key * Import key after pub, and as a batch * Should fix RPM SIGNING KEYNAME * Add pinentry, skip testing for now * Install pinentry-tty * Adds gpg sign cmd extra args * Adds passphrase to cmd extra args * Sed < and > to &lt; and &gt; * Remove replace * Fixes syntax error * Remove skipped tests * Process keys from stdin without using filesystem * Attempt retrieving RPM_SIGNING_PASSPHRASE env instead of writing passphrase to disk
1 parent 456d372 commit d5dc7a1

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/upload_release_github_attachment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,20 @@ jobs:
3131
- name: Install test dependencies
3232
run: cd / && sudo apt-get update && sudo apt-get install wget rpm2cpio && sudo wget -q https://download.rockylinux.org/pub/rocky/8/AppStream/x86_64/os/Packages/g/geolite2-city-20180605-1.el8.noarch.rpm && sudo wget -q https://download.rockylinux.org/pub/rocky/8/AppStream/x86_64/os/Packages/g/geolite2-country-20180605-1.el8.noarch.rpm && rpm2cpio geolite2-city-20180605-1.el8.noarch.rpm | sudo cpio -i --make-directories && rpm2cpio geolite2-country-20180605-1.el8.noarch.rpm | sudo cpio -i --make-directories
3333

34+
- name: Prepare RPM GPG signing
35+
run: |
36+
sudo apt-get install expect pinentry-tty;
37+
printf "RPM_SIGNING_KEYNAME=%q\n" "$(echo "${{ secrets.RPM_SIGNING_PUBLIC_KEY }}" | gpg --show-keys --with-colons | awk -F':' '/uid/{print $10}')" >> $GITHUB_ENV;
38+
echo "${{ secrets.RPM_SIGNING_PRIVATE_KEY }}" | gpg --batch --import;
39+
echo "%_gpg_sign_cmd_extra_args --pinentry-mode loopback --passphrase \"%{getenv:RPM_SIGNING_PASSPHRASE}\"" >> "${HOME}/.rpmmacros";
40+
3441
- name: Build a jar and rpm for release
3542
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean package -Pbuild-shaded-jar && cd rpm/ && mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= -f rpm.pom.xml package
3643
env:
3744
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
RPM_SIGNING_KEYNAME: ${{ env.RPM_SIGNING_KEYNAME }}
46+
RPM_SIGNING_PASSPHRASE: ${{ secrets.RPM_SIGNING_PASSPHRASE }}
47+
3848

3949
- name: Attach rpm to release
4050
uses: softprops/action-gh-release@v1
@@ -49,3 +59,4 @@ jobs:
4959
to_repository: teragrep/pkg_01
5060
deploy_key: ${{ secrets.PKG_01_DEPLOY_KEY }}
5161
files: rpm/target/rpm/com.teragrep-pth_10/RPMS/noarch/com.teragrep-pth_10-*.noarch.rpm
62+
if: ${{ startsWith(github.repository, 'teragrep/') }}

rpm/rpm.pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
<defaultGroupname>root</defaultGroupname>
5858
<defaultFilemode>0644</defaultFilemode>
5959
<defaultDirmode>0755</defaultDirmode>
60+
<keyname>${env.RPM_SIGNING_KEYNAME}</keyname>
61+
<keyPassphrase>
62+
<passphrase>${env.RPM_SIGNING_PASSPHRASE}</passphrase>
63+
</keyPassphrase>
6064
<defineStatements>
6165
<defineStatement>_build_id_links none</defineStatement>
6266
<defineStatement>__provides_exclude ^osgi\\(.*$</defineStatement>

0 commit comments

Comments
 (0)