diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 40daa1f..858bb95 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -40,6 +40,36 @@ pipeline { } } } + + stage('Sign') { + when { + branch 'main' + } + environment { + GNUPGHOME = "${env.WORKSPACE_TMP}/gnupg" + } + steps { + withCredentials([ + file( + credentialsId: 'rpm-gpg-key', + variable: 'RPM_GPG_PRIVATE_KEY', + ), + file( + credentialsId: 'rpm-gpg-key-passphrase', + variable: 'RPM_GPG_KEY_PASSPHRASE', + ), + ]) { + sh '. ci/sign.sh' + } + } + } + + stage('Archive') { + steps { + archiveArtifacts '*.rpm' + } + } + } } } diff --git a/ci/sign.sh b/ci/sign.sh new file mode 100644 index 0000000..3ec28ab --- /dev/null +++ b/ci/sign.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ $(id -u) -eq 0 ]; then + exec setpriv --clear-groups --reuid 1000 --regid 1000 --inh-caps=-all \ + sh -ex ci/sign.sh +fi + +install -m u=rwx,go= -d "${GNUPGHOME}" +cat > "${GNUPGHOME}"/gpg-agent.conf <