Skip to content

Commit f8b98e1

Browse files
committed
Sign with GPG key
1 parent da1d797 commit f8b98e1

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
name: Build
22

33
on:
4+
pull_request:
5+
branches:
6+
- develop
47
schedule:
58
- cron: '0 2 * * *'
69

10+
env:
11+
CI_GPG_KEYID: ${{ secrets.CI_GPG_KEYID }}
12+
CI_GPG_KEY: ${{ secrets.CI_GPG_KEY }}
13+
CI_GPG_PASSPHRASE: ${{ secrets.CI_GPG_PASSPHRASE }}
14+
715
jobs:
816
build:
917
if: "!contains(github.event.head_commit.message, 'ci skip')"
@@ -19,7 +27,11 @@ jobs:
1927
set -x
2028
dnf install -y dnf-plugins-core
2129
dnf copr enable -y plfiorini/liri-tools
22-
dnf install -y ostree-upload flatpak-builder
30+
dnf install -y ostree-upload flatpak-builder gnupg2 pinentry
31+
- name: Import GPG key
32+
run: |
33+
.github/workflows/scripts/setup-gpg
34+
gpg --list-keys ${CI_GPG_KEYID}
2335
- name: Build
2436
run: |
2537
set -x

.github/workflows/scripts/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ flatpak remote-add flathub --from https://flathub.org/repo/flathub.flatpakrepo -
1717
now=$(date +"%Y-%m-%d %H:%M:%S")
1818

1919
flatpak-builder build ${app_id}.yaml \
20+
--gpg-sign=${CI_GPG_KEYID} \
21+
--gpg-homedir=${HOME}/.gnupg \
2022
--force-clean \
2123
--subject="Build of ${app_id} at ${now}" \
2224
--install-deps-from=flathub \
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: 2020 Pier Luigi Fiorini <[email protected]>
3+
#
4+
# SPDX-License-Identifier: CC0-1.0
5+
6+
set -e
7+
8+
export GNUPGHOME=${HOME}/.gnupg
9+
10+
mkdir -m 700 -p ${GNUPGHOME}
11+
printf "${CI_GPG_KEY}" | base64 --decode > ${GNUPGHOME}/private.key
12+
gpg --batch --import ${GNUPGHOME}/private.key
13+
14+
cat > ${GNUPGHOME}/gpg.conf <<EOF
15+
use-agent
16+
pinentry-mode loopback
17+
passphrase ${CI_GPG_PASSPHRASE}
18+
no-tty
19+
batch
20+
yes
21+
EOF

0 commit comments

Comments
 (0)