Skip to content

Commit 424f65e

Browse files
committed
Migrated from travis-ci to github actions for CI/CD
1 parent 25d8a8d commit 424f65e

File tree

6 files changed

+84
-63
lines changed

6 files changed

+84
-63
lines changed

.travis/maven-settings.xml renamed to .github/maven-settings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
</server>
1212
<server>
1313
<id>github.com</id>
14-
<username>${env.GITHUB_USERNAME}</username>
15-
<password>${env.GITHUB_TOKEN}</password>
14+
<username>${env.GIT_HUB_USERNAME}</username>
15+
<password>${env.GIT_HUB_TOKEN}</password>
1616
</server>
1717
</servers>
1818
<profiles>

.github/workflows/build.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: spt-development-logging-spring
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Set up JDK 18
13+
uses: actions/setup-java@v3
14+
with:
15+
java-version: '18'
16+
distribution: 'adopt'
17+
18+
- name: Build with Maven
19+
run: mvn clean install -B
20+
21+
release:
22+
runs-on: ubuntu-latest
23+
needs: build
24+
if: github.ref == 'refs/heads/main'
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Set up JDK 18
30+
uses: actions/setup-java@v3
31+
with:
32+
java-version: '18'
33+
distribution: 'adopt'
34+
35+
- name: Determine version
36+
run: echo "POM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec | sed -e 's/-SNAPSHOT//')" >> $GITHUB_ENV
37+
38+
- name: Import GPG key
39+
id: import_gpg
40+
uses: crazy-max/ghaction-import-gpg@v5
41+
with:
42+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
43+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
44+
45+
- name: Configure Git User for updating version
46+
run: |
47+
git config user.email "actions@github.com"
48+
git config user.name "GitHub Actions"
49+
50+
- name: Create release
51+
run: mvn --settings .github/maven-settings.xml release:prepare release:perform -DskipTests -Prelease -B
52+
env:
53+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
54+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
55+
GIT_HUB_USERNAME: ${{ secrets.GIT_HUB_USERNAME }}
56+
GIT_HUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
57+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
58+
59+
- name: Create GitHub release
60+
id: create_release
61+
uses: actions/create-release@v1
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
tag_name: ${{ env.POM_VERSION }}
66+
release_name: ${{ env.POM_VERSION }}
67+
draft: false
68+
prerelease: false
69+
70+
- name: Upload GitHub release asset
71+
id: upload-release-asset
72+
uses: actions/upload-release-asset@v1
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
with:
76+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
77+
asset_path: target/spt-development-logging-spring-${{ env.POM_VERSION }}.jar
78+
asset_name: spt-development-logging-spring-${{ env.POM_VERSION }}.jar
79+
asset_content_type: application/java-archive

.travis.yml

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

.travis/gpg.asc.enc

-3.72 KB
Binary file not shown.

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
logging-spring -----------------------------------------------------------------
99
````
1010

11-
[![build_status](https://travis-ci.com/spt-development/spt-development-logging-spring.svg?branch=main)](https://travis-ci.com/spt-development/spt-development-logging-spring)
11+
[![build_status](https://github.com/spt-development/spt-development-logging-spring/actions/workflows/build.yml/badge.svg)](https://github.com/spt-development/spt-development-logging-spring/actions)
1212

1313
A library for adding logging (at the start, end and on exception) to public methods of classes annotated with
1414
`@RestController`, `@Service` or `@Repository` or methods annotated with `@JmsListener`.
@@ -50,9 +50,4 @@ To build the library, run the following maven command:
5050
Release
5151
=======
5252

53-
To build a release and upload to Maven Central run the following maven command:
54-
55-
$ export GPG_TTY=$(tty) # Required on Mac OS X
56-
$ mvn deploy -DskipTests -Prelease
57-
58-
NOTE. This is currently a manual step as not currently integrated into the build.
53+
To build a release and upload to Maven Central push to `main`.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
<version>${maven-release-plugin.version}</version>
348348
<configuration>
349349
<goals>deploy</goals>
350-
<scmCommentPrefix>[skip travis] [maven-release-plugin] </scmCommentPrefix>
350+
<scmCommentPrefix>[skip ci] [maven-release-plugin] </scmCommentPrefix>
351351
<tagNameFormat>@{project.version}</tagNameFormat>
352352
</configuration>
353353
</plugin>

0 commit comments

Comments
 (0)