Skip to content

Commit

Permalink
🚀Deploy to Github Package
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaumoron Julien committed Dec 22, 2020
1 parent 0f1550a commit a22a0b6
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 49 deletions.
51 changes: 31 additions & 20 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Maven Package
name: Maven Deploy

on:
release:
types: [created]
branches: [ main ]

jobs:

build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

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

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

deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

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

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2

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

- name: Deploy to Github Package Registry
env:
GITHUB_USERNAME: ${{ github.BUKKIT_TIMER_USER }}
GITHUB_TOKEN: ${{ github.BUKKIT_TIMER_TOKEN }}
run: mvn --settings settings.xml --file pom.xml deploy

38 changes: 25 additions & 13 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- 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: Create package
run: mkdir staging && cp target/*.jar staging
- uses: actions/upload-artifact@v2
with:
name: BukkitTimer
path: staging
- name: Checkout
uses: actions/checkout@v2

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

- name: Build Maven Project
run: |
mvn -B package --file pom.xml
mkdir staging && cp target/*.jar staging
- name: Set up cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: Bukkit Timer
path: staging
57 changes: 41 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>fr.DevsCheese</groupId>
<artifactId>bukkitTimer</artifactId>
<artifactId>bukkit-timer</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

Expand All @@ -21,12 +21,47 @@
<distributionManagement>
<repository>
<id>github</id>
<name>Bukkit Timer</name>
<url>https://maven.pkg.github.com/DevsCheese/Bukkit-timer</url>
<name>GitHub DevsCheese Apache Maven Packages</name>
<url>https://maven.pkg.github.com/DevsCheese/bukkit-timer</url>
</repository>
</distributionManagement>

<developers>
<developer>
<name>Devs Cheese</name>
<email>devs.cheese@gmail.com</email>
<organization>com.github.devscheese</organization>
<organizationUrl>https://github.com/DevsCheese/Bukkit-timer</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/DevsCheese/Bukkit-timer.git</connection>
<developerConnection>scm:git:https://github.com/DevsCheese/Bukkit-timer.git</developerConnection>
<url>https://github.com/DevsCheese/Bukkit-timer</url>
<tag>Bukkit-timer</tag>
</scm>

<build>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.9.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -37,21 +72,11 @@
<target>${java.version}</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>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
<resources>
Expand Down

0 comments on commit a22a0b6

Please sign in to comment.