Skip to content

Commit

Permalink
Merge branch 'travis'
Browse files Browse the repository at this point in the history
  • Loading branch information
JanMosigItemis committed Jul 4, 2019
2 parents 90601ce + df86787 commit 0fcf249
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .ci/before_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

end_with_error()
{
echo "ERROR: ${1:-"Unknown Error"} Exiting." 1>&2
exit 1
}

declare -r custom_gpg_home="./.ci"
declare -r secring_auto="${custom_gpg_home}/secring.auto"
declare -r pubring_auto="${custom_gpg_home}/pubring.auto"

echo
echo "Decrypting secret gpg keyring.."
{ echo $super_secret_password | gpg --passphrase-fd 0 "${secring_auto}".gpg ; } || { end_with_error "Failed to decrypt secret gpg keyring." ; }
echo Success!

echo
echo Importing keyrings..
{ gpg --home "${custom_gpg_home}" --import "${secring_auto}" ; } || { end_with_error "Could not import secret keyring into gpg." ; }
{ gpg --home "${custom_gpg_home}" --import "${pubring_auto}" ; } || { end_with_error "Could not import public keyring into gpg." ; }
echo Success!

echo
65 changes: 65 additions & 0 deletions .ci/pubring.auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBF0eHa0BEAC5fEwOauFdXodqCh6N+4dkTurV9ZwAOfD7pPZFgyMKemB4+cux
rd2v08HrS8eiVrZJSu8XQDvzzeXal3CmI+X8sCE9V0ZevYtdZBzZqAD4r4OFET+y
dl4h6sG69mNrGMVe4YLbMyELD6OylsLuQqWosj9D9FrGvqpH/ZkD0I1JQX3UVvxv
FkNSs9amrU63E4/JsbYfnMAttYyr25Zj9sHlsSoTcIt348W2DFCFN1VISEEOXoAl
kPeG11toigxqbbY2nQH4AVbrapPvvws/QknmArng4TFF7/hYLqWN7UoK4fO+XNzF
9XCbH1y7neTJF/Uw4tkrbiAdkkGb5iFiEXriszSkql/+IrZX2ZP7ErVHK6ZHz22u
vZSARO1wB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1pLv5apEr+5
jP9cqQ8jfYUc1Ywtsbv6Nxu0SVHajofXuPX8DnpaEj9rAbTFg8sWqt+XR1QrTFW8
17o7zW/+BMQnsThBPbEY++Pgew9xe8pUDbRsBxSmDh4au1iQt5ajej8Z3psN+/rk
A2IHL1M1GfkPTDdio8iU7btCiJv1AfI9DL8fqNlUNiNJpzP8/ijhFOvFtnTqD4tq
ym6o38NWQFn53Q3xEvKZb/q2Vb4f7FAK4blXbhu5GlzJnC1Br48lLxj1GwTYB9At
MmmFy02oklYZsnCJ+Q3zg3gOgV1pjLICCUIiBFEEFYS37o8=
=w7c6
-----END PGP PUBLIC KEY BLOCK-----
38 changes: 38 additions & 0 deletions .ci/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

end_with_error()
{
echo "ERROR: ${1:-"Unknown Error"} Exiting." 1>&2
exit 1
}

export TZ=Europe/Berlin
export TIMESTAMP=`(date +'%Y%m%d%H%M')`

# see https://graysonkoonce.com/getting-the-current-branch-name-during-a-pull-request-in-travis-ci/
export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
echo "TARVIS_TAG=${TRAVIS_TAG}, TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH, TIMESTAMP=${TIMESTAMP}"

if [[ -z "${TRAVIS_TAG}" ]] ; then
TRAVIS_TAG="no_tag"
fi

export release="yubiset_${TRAVIS_TAG}.${TIMESTAMP}"
export release_zip="${release}.zip"
export release_hash="${release}.sha512"
export release_gpg="${release}.sha512.gpg"

echo
echo "Creating ${release_zip}.."
{ zip -rT9 -x".git/*" -x"*.gitignore" -x"*.travis.yml" -x".ci/*" "${release_zip}" * ; } || { end_with_error "Creating zip file failed." ; }
echo "Success!"

echo
echo "Creating ${release_hash}.."
{ sha512sum "${release_zip}" > "${release_hash}" ; } || { end_with_error "Creating hash file failed." ; }
echo Success!

echo
echo "Signing hash file.."
{ gpg --home ./.ci --clearsign -u E5F1E2D4 -o "${release_gpg}" "${release_hash}" ; } || { end_with_error "Creating signature file failed." ; }
echo Success!
Binary file added .ci/secring.auto.gpg
Binary file not shown.
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
if: NOT tag IS blank

language: minimal

notifications:
email:
on_success: never
on_failure: always

matrix:
include:
- os: linux
dist: trusty

# Super secret password to decrypt the private signing key
env:
global:
secure: "Apnk0bYrrgzhwWe7EsaM/3snaXf9GA3wAsGFnZ5lMhxUVulY3QVYbhRYkfbtDNezS1ejeatmivfwROjdwU/dRwiTFKlthqQOn2mWVZyPzYCRckmlT3pDg3/JCQtvyewKLCTqqMpvBx1CYJ5n4NBSGK7Msxw/ex9XwdR5ZMqR3TPu2QDjHFkmTCow4LkM34XkoYvkOTuxk8qTrGABNA4OPW8lci1vdQSegxIK2mKT/C/q9hvUrLPowEdn+b6/kV9USLBUourl7frmCpz3lfjn8k415qWfXNAPArszu1B8KoX68KiijOZWir5b4T7LrFeQ1WPOsgpW24xVB7hfC8J5CkE8qUwIJLqIunIsNn1dsBHO/NYGj1G5hbHMgrVRPkjxQSfjzMBt+ajYNaQZhresj/fZNCBnZJZNjgCfgWz7LGlgejFtElIn7pLR5PgZWQf9N38OanGGn1VhoPbYN1M0nYlfIv/QZTpCC0e4DPcNgVq5etaNjaQ8nC0+NA/z67hXb7Y5D9ulMuoKXeTS04TeuPSeeVio2vl/pGL7ZghdSTAoQAZbpXgzR0PygJh4Y+3E1bDK/d0Y0HR19lUadohPbdM1IiPHAReim0lft6TcJaO6dM7dY9SLFt0fkWQSSJ9teBb7lWJakFVqnNr70UdCWZ6i/F5VklecjeTCXJ0szhw="

# Skip installation phase
install: true

before_script:
- . ./.ci/before_script.sh

script:
- . ./.ci/script.sh

# skip-cleanup: true -> Prevent deletion of created artifacts after install and before deployment
deploy:
- provider: releases
api_key:
secure: $GITHUB_API_KEY
file:
- $release_zip
- $release_hash
- $release_gpg
skip-cleanup: true
overwrite: true
draft: false
prerelease: true
on:
repo: JanMosigItemis/yubiset
tags: true

0 comments on commit 0fcf249

Please sign in to comment.