Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github Action to build the plugin #50

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build

on:
workflow_dispatch:
push:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 'Checkout source code'
uses: actions/checkout@v4
- name: 'Set up JDK'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

- name: 'Cache dependencies'
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: 'Build, test, and package'
run: mvn -B package --file pom.xml

- name: 'Get artifact version'
id: pomVersion
run: |
VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )
echo "version=${VERSION}" >> $GITHUB_OUTPUT

- name: 'Upload artifact'
uses: actions/upload-artifact@v3
with:
name: Cannons-${{ steps.pomVersion.outputs.version }}.jar
path: target/Cannons-${{ steps.pomVersion.outputs.version }}.jar
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Cannons
=======
[![build](https://github.com/tadhunt/Cannons/actions/workflows/build.yml/badge.svg?branch=feature/github-actions)](https://github.com/tadhunt/Cannons/actions/workflows/build.yml)

by derPavlov

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -168,7 +168,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<version>3.5.0</version>
<configuration>
<relocations>
<relocation>
Expand Down