Skip to content

Commit

Permalink
feat: add CI workflows (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
liewstar authored Aug 5, 2024
1 parent ee40972 commit 554a825
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Always validate the PR title AND all the commits
titleAndCommits: true
36 changes: 36 additions & 0 deletions .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 20

- name: Install semantic-release and plugins
run: npm install -D semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github

- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
17 changes: 17 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"branches": "master",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
["@semantic-release/github", {
"assets": [
{
"path": "target/casbin-java-cli.jar"
}
]
}]
]
}
66 changes: 51 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
<artifactId>casbin-java-cli</artifactId>
<version>1.0-SNAPSHOT</version>

<packaging>jar</packaging>

<!-- <parent>-->
<!-- <groupId>org.sonatype.oss</groupId>-->
<!-- <artifactId>oss-parent</artifactId>-->
<!-- <version>7</version>-->
<!-- </parent>-->

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.36</slf4j.version>
</properties>

<dependencies>
Expand All @@ -24,24 +31,53 @@
<version>1.4</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.30</version>
</dependency>
</dependencies>
</project>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.casbin.Client</mainClass>
</transformer>
</transformers>
<finalName>${project.artifactId}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 554a825

Please sign in to comment.