Skip to content

Commit edb0c4d

Browse files
authored
Merge pull request #46 from ericwcc/setup_github_action
Replace travis-ci with github action
2 parents 6e42d86 + 161810f commit edb0c4d

File tree

9 files changed

+58
-138
lines changed

9 files changed

+58
-138
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: build
2+
on:
3+
push:
4+
branches: [ master ]
5+
tags: [ "*.*.*" ]
6+
jobs:
7+
build:
8+
runs-on: ubuntu-18.04
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-java@v1
12+
with:
13+
java-version: 8
14+
env:
15+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
16+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
17+
- name: install
18+
run: mvn --settings .github/workflows/mvnsettings.xml install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
19+
- name: deploy
20+
run: .github/workflows/deploy.sh

.github/workflows/deploy.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# update current version number to a TAG version if this is a tag build
5+
if [ "$GITHUB_REF_TYPE" = "tag" ]
6+
then
7+
echo "on a tag -> set pom.xml <version> to $GITHUB_REF_NAME for release"
8+
mvn --settings .github/workflows/mvnsettings.xml org.codehaus.mojo:versions-maven-plugin:2.3:set -DnewVersion=$GITHUB_REF_NAME
9+
else
10+
echo "not on a tag -> keep snapshot version in pom.xml"
11+
fi
12+
13+
# cleanup and generate gpg keys
14+
if [ -d "$HOME/.gnupg" ]; then
15+
shred -v ~/.gnupg/*
16+
rm -rf ~/.gnupg
17+
fi
18+
19+
source .github/workflows/gpg.sh
20+
21+
# DEPLOY \o/
22+
mvn clean deploy --settings .github/workflows/mvnsettings.xml -DskipTests=true --batch-mode --update-snapshots
23+
24+
# cleanup gpg keys, just to be safe
25+
find ~/.gnupg/ -type f -exec shred -v {} \;
26+
rm -rf ~/.gnupg

.travis/gpg.sh renamed to .github/workflows/gpg.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ gpg --batch --gen-key gen-key-script
2929
# uid Lars K.W. Gohlke <[email protected]>
3030
# ssb 4096R/CC1613B2 2016-09-08
3131
# ssb 4096R/55B7CAA2 2016-09-08
32-
gpg -K
33-
export GPG_KEYNAME=$(gpg -K | grep ^sec | cut -d/ -f2 | cut -d\ -f1 | head -n1)
32+
gpg -K --keyid-format=short
33+
export GPG_KEYNAME=$(gpg -K --keyid-format=short | grep ^sec | cut -d/ -f2 | cut -d\ -f1 | head -n1)
3434

3535
# cleanup local configuration
3636
shred gen-key-script
3737

3838
# publish the gpg key
39-
# (use keyserver.ubuntu.com as travis request keys from this server,
40-
# we avoid synchronization issues, while releasing)
39+
# (use a single public key server e.g.keyserver.ubuntu.com
40+
# to avoid synchronization issues, while releasing)
4141
echo "Uploading key ${GPG_KEYNAME} to keyserver.ubuntu.com"
4242
gpg --keyserver keyserver.ubuntu.com --send-keys ${GPG_KEYNAME}
4343

.travis.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.travis/after_deploy.sh

Lines changed: 0 additions & 51 deletions
This file was deleted.

.travis/deploy.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

.travis/github_deploy_key.enc

-3.17 KB
Binary file not shown.

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,14 @@
413413
<groupId>org.apache.maven.plugins</groupId>
414414
<artifactId>maven-gpg-plugin</artifactId>
415415
<version>${maven-gpg-plugin.version}</version>
416+
<configuration>
417+
<!-- refer to https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#extra-setup-for-pomxml,
418+
required for Github Action runner to prevent gpg from using pinentry programs -->
419+
<gpgArguments>
420+
<arg>--pinentry-mode</arg>
421+
<arg>loopback</arg>
422+
</gpgArguments>
423+
</configuration>
416424
<executions>
417425
<execution>
418426
<id>sign-artifacts</id>

0 commit comments

Comments
 (0)