Skip to content

Commit 545893a

Browse files
committed
Create CI action
1 parent e6e8a61 commit 545893a

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request_target:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Code
12+
uses: actions/checkout@v2
13+
14+
- name: Set Up Java
15+
uses: actions/setup-java@v2
16+
with:
17+
distribution: 'adopt'
18+
java-version: '17'
19+
20+
# Use cache to speed up build
21+
- name: Cache Maven Repo
22+
uses: actions/cache@v2
23+
id: cache
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
28+
- name: Build With Maven
29+
run: mvn -e clean package -am -P all
30+
31+
# Upload artifacts
32+
- name: Upload Distributable Jar
33+
id: upload-final
34+
uses: actions/upload-artifact@v2
35+
with:
36+
name: dist
37+
path: ./target/AnvilUnlocker.jar
38+
39+
release:
40+
name: Create Github Release
41+
needs: [ build ]
42+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout Code
46+
uses: actions/checkout@v2
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Download Artifacts
51+
uses: actions/download-artifact@v2
52+
53+
- name: Parse Tag Name
54+
id: get_version
55+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
56+
57+
- name: Create Release
58+
id: create-release
59+
uses: softprops/action-gh-release@v0.1.5
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
name: AnvilUnlocker ${{ steps.get_version.outputs.result }}
64+
draft: true
65+
prerelease: true
66+
files: ./dist/AnvilUnlocker.jar

0 commit comments

Comments
 (0)