Skip to content

Commit 37c66f6

Browse files
committed
Migrated from travis-ci to github actions for CI/CD
1 parent e069762 commit 37c66f6

File tree

6 files changed

+98
-66
lines changed

6 files changed

+98
-66
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: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: spt-development-logging-spring-boot
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+
- name: Mutation testing
22+
run: mvn org.pitest:pitest-maven:mutationCoverage -B
23+
24+
release:
25+
runs-on: ubuntu-latest
26+
needs: build
27+
if: github.ref == 'refs/heads/main'
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
32+
- name: Set up JDK 18
33+
uses: actions/setup-java@v3
34+
with:
35+
java-version: '18'
36+
distribution: 'adopt'
37+
38+
- name: Determine version
39+
run: echo "POM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec | sed -e 's/-SNAPSHOT//')" >> $GITHUB_ENV
40+
41+
- name: Import GPG key
42+
id: import_gpg
43+
uses: crazy-max/ghaction-import-gpg@v5
44+
with:
45+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
46+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
47+
48+
- name: Configure Git User for updating version
49+
run: |
50+
git config user.email "actions@github.com"
51+
git config user.name "GitHub Actions"
52+
53+
- name: Create release
54+
run: mvn --settings .github/maven-settings.xml release:prepare release:perform -DskipTests -Prelease -B
55+
env:
56+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
57+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
58+
GIT_HUB_USERNAME: ${{ secrets.GIT_HUB_USERNAME }}
59+
GIT_HUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
60+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
61+
62+
- name: Create GitHub release
63+
id: create_release
64+
uses: actions/create-release@v1
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
tag_name: ${{ env.POM_VERSION }}
69+
release_name: ${{ env.POM_VERSION }}
70+
draft: false
71+
prerelease: false
72+
73+
- name: Upload GitHub release asset
74+
id: upload-release-asset
75+
uses: actions/upload-release-asset@v1
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
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
80+
asset_path: spt-development-logging-spring-boot-autoconfigure/target/spt-development-logging-spring-boot-autoconfigure-${{ env.POM_VERSION }}.jar
81+
asset_name: spt-development-logging-spring-boot-autoconfigure-${{ env.POM_VERSION }}.jar
82+
asset_content_type: application/java-archive
83+
84+
- name: Upload GitHub release asset
85+
id: upload-release-asset-2
86+
uses: actions/upload-release-asset@v1
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
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
91+
asset_path: spt-development-logging-spring-boot-starter/target/spt-development-logging-spring-boot-starter-${{ env.POM_VERSION }}.jar
92+
asset_name: spt-development-logging-spring-boot-starter-${{ env.POM_VERSION }}.jar
93+
asset_content_type: application/java-archive

.travis.yml

Lines changed: 0 additions & 56 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-boot-------------------------------------------------------------
99
````
1010

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

1313
Library for integrating
1414
[spt-development/spt-development-logging-spring](https://github.com/spt-development/spt-development-logging-spring)
@@ -36,9 +36,4 @@ To build the library, run the following maven command:
3636
Release
3737
=======
3838

39-
To build a release and upload to Maven Central run the following maven command:
40-
41-
$ export GPG_TTY=$(tty) # Required on Mac OS X
42-
$ mvn deploy -DskipTests -Prelease
43-
44-
NOTE. This is currently a manual step as not currently integrated into the build.
39+
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
@@ -286,7 +286,7 @@
286286
<version>${maven-release-plugin.version}</version>
287287
<configuration>
288288
<goals>deploy</goals>
289-
<scmCommentPrefix>[skip travis] [maven-release-plugin] </scmCommentPrefix>
289+
<scmCommentPrefix>[skip ci] [maven-release-plugin] </scmCommentPrefix>
290290
<tagNameFormat>@{project.version}</tagNameFormat>
291291
</configuration>
292292
</plugin>

0 commit comments

Comments
 (0)