Skip to content

Commit 23f5508

Browse files
authored
Add workflow for GitHub action and packages (#1)
1 parent e86980a commit 23f5508

File tree

4 files changed

+66
-13
lines changed

4 files changed

+66
-13
lines changed

.github/workflows/build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2+
name: Maven Build and Deploy
3+
4+
# Trigger conditions (build only on pull_request for features and for a release)
5+
on:
6+
release:
7+
types:
8+
- published
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK 1.8 and GitHub Packages Repo
20+
uses: actions/setup-java@v1
21+
with:
22+
java-version: 1.8
23+
server-id: com.originstamp # Value of the distributionManagement/repository/id field of the pom.xml
24+
settings-path: ${{ github.workspace }} # location for the settings.xml file
25+
26+
# Set a new version depending on source branch and build number (can't overwrite existing versions)
27+
- name: Update Maven version (pull request)
28+
if: github.event_name == 'pull_request'
29+
run: mvn versions:set -X -DnewVersion=${GITHUB_HEAD_REF##*/}.${{ github.run_number }} -s $GITHUB_WORKSPACE/settings.xml
30+
31+
# Set a new version depending on tag name (can only set a version once!)
32+
- name: Update Maven version (release)
33+
if: github.event_name == 'release'
34+
run: mvn versions:set -DnewVersion=${GITHUB_REF##*/} -s $GITHUB_WORKSPACE/settings.xml
35+
36+
# Built it!
37+
- name: Build with Maven
38+
run: mvn -B package -DskipTests=true --file pom.xml -s $GITHUB_WORKSPACE/settings.xml
39+
40+
# Deploy / Publish to GitHub packages via Apache Maven (with own GitHub Token)
41+
- name: Deploy to GitHub Packages
42+
run: mvn -e -Dmaven.wagon.http.pool=false -DskipTests=true deploy -s $GITHUB_WORKSPACE/settings.xml
43+
env:
44+
GITHUB_TOKEN: ${{ github.token }}

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
language: java
22
jdk:
3-
- oraclejdk8
3+
- openjdk8
44
before_script:
55
- wget https://dist.ipfs.io/go-ipfs/v0.4.16/go-ipfs_v0.4.16_linux-amd64.tar.gz -O /tmp/go-ipfs_linux-amd64.tar.gz
66
- tar -xvf /tmp/go-ipfs_linux-amd64.tar.gz
77
- export PATH=$PATH:$PWD/go-ipfs/
88
- ipfs init
99
- ipfs daemon --enable-pubsub-experiment &
1010
script:
11-
- mvn clean verify
11+
- mvn clean verify -DskipTests=true

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,24 @@ You can use this project by including `ipfs.jar` from one of the [releases](http
2525

2626
### Maven, Gradle, SBT
2727

28-
Package managers are supported through [JitPack](https://jitpack.io/#ipfs/java-ipfs-api/) which supports Maven, Gradle, SBT, etc.
28+
Package managers are supported through GitHub Packages which supports Maven, Gradle, SBT, etc.
2929

3030
for Maven, add the following sections to your pom.xml (replacing $LATEST_VERSION):
31+
3132
```
3233
<repositories>
33-
<repository>
34-
<id>jitpack.io</id>
35-
<url>https://jitpack.io</url>
36-
</repository>
34+
<repository>
35+
<id>com.originstamp</id>
36+
<url>https://maven.pkg.github.com/OriginStampTimestamping/java-ipfs-api</url>
37+
</repository>
3738
</repositories>
3839
3940
<dependencies>
40-
<dependency>
41-
<groupId>com.github.OriginStampTimestamping</groupId>
42-
<artifactId>java-ipfs-api</artifactId>
43-
<version>$LATEST_VERSION</version>
44-
</dependency>
41+
<dependency>
42+
<groupId>com.originstamp.ipfs</groupId>
43+
<artifactId>java-ipfs-api</artifactId>
44+
<version>$LATEST_VERSION</version>
45+
</dependency>
4546
</dependencies>
4647
```
4748

pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44

5-
<groupId>com.github.ipfs</groupId>
5+
<groupId>com.originstamp.ipfs</groupId>
66
<artifactId>java-ipfs-api</artifactId>
77
<version>v1.2.2-SNAPSHOT</version>
88
<packaging>jar</packaging>
@@ -43,6 +43,14 @@
4343
</repository>
4444
</repositories>
4545

46+
<distributionManagement>
47+
<!-- Used as deployment repository in GitHub -->
48+
<repository>
49+
<id>com.originstamp</id>
50+
<url>https://maven.pkg.github.com/OriginStampTimestamping/java-ipfs-api</url>
51+
</repository>
52+
</distributionManagement>
53+
4654
<dependencies>
4755
<dependency>
4856
<groupId>junit</groupId>

0 commit comments

Comments
 (0)