Skip to content
This repository was archived by the owner on Jul 24, 2021. It is now read-only.

Commit 3e82860

Browse files
authored
👷 Add release task
1 parent c063504 commit 3e82860

File tree

3 files changed

+60
-4
lines changed

3 files changed

+60
-4
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
name: Gradle Build
22
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- dev
37
push:
48
branches:
59
- master
10+
- dev
11+
612
jobs:
713
build:
814
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
6+
name: Create Release
7+
8+
jobs:
9+
build:
10+
name: Create Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2.3.4
15+
- name: Set up JDK
16+
uses: actions/setup-java@v1.4.3
17+
with:
18+
java-version: 1.11
19+
java-package: jdk
20+
- name: Make gradlew executable
21+
run: chmod +x ./gradlew
22+
- name: Build with Gradle
23+
id: gradle_build
24+
run: ./gradlew clean build
25+
- name: Create Release
26+
id: create_release
27+
uses: actions/create-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
30+
with:
31+
tag_name: ${{ github.run_id }}
32+
release_name: New Release ${{ steps.gradle_build.outputs.date }}
33+
body: |
34+
New version released by Github Actions (ID: ${{ github.run_id }})
35+
draft: false
36+
prerelease: false
37+
- name: Upload Release Asset
38+
id: upload-release-asset
39+
uses: actions/upload-release-asset@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
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
44+
asset_path: build/libs/**
45+
asset_name: InventoryAPI.jar
46+
asset_content_type: application/java-archive

build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ plugins {
88
group 'fr.bakaaless'
99
version '1.0.4'
1010

11-
def spigotVersion = "1.16"
12-
def subVersion = ".5"
11+
def spigotVersion = '1.16'
12+
def subVersion = '.5'
1313

1414
sourceCompatibility = targetCompatibility = '1.11'
1515

1616
repositories {
17-
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots" } // Spigot
18-
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } // Spigot
17+
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots' }
18+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
1919
mavenCentral()
2020
}
2121

@@ -28,4 +28,8 @@ processResources {
2828
filter ReplaceTokens, tokens: [NAME: rootProject.name, VERSION: version, APIVERSION: spigotVersion]
2929
}
3030

31+
jar {
32+
archiveName rootProject.name + '.jar'
33+
}
34+
3135
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

0 commit comments

Comments
 (0)