-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (65 loc) · 2.29 KB
/
release_jar.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Run pre-merge tests
on:
push:
branches:
- main
paths:
- 'pom.xml'
jobs:
release-jar:
# build with maven to make sure things compile correctly
name: Compile with maven and release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'zulu'
- name: Extract version
id: pom
run: |
echo "POM_VERSION=$(mvn -B -Dexec.executable='echo' -Dexec.args='${project.version}' exec:exec -q)" >> $GITHUB_ENV
- name: Compile Jar with maven
run: mvn package
- name: Find artifact and get file name
id: find_artifact
run: |
CMD="ls ./target/LightSheetManager-*.jar | grep -v -e '-sources' -e '-javadoc'"
echo "Command: $CMD"
ARTIFACT_PATH=$(eval $CMD)
ARTIFACT_NAME=$(basename $ARTIFACT_PATH)
echo "ARTIFACT_PATH=$ARTIFACT_PATH" >> $GITHUB_ENV
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
echo "Artifact Path: $ARTIFACT_PATH"
echo "Artifact Name: $ARTIFACT_NAME"
- name: Create Git Tag
id: create_tag
run: |
TAG_NAME="v${POM_VERSION}"
git tag $TAG_NAME
git push origin $TAG_NAME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: v${{ env.POM_VERSION }}
release_name: Release v${{ env.POM_VERSION }}
body: Auto-generated release from ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.ARTIFACT_PATH }}
asset_name: ${{ env.ARTIFACT_NAME }}
asset_content_type: application/java-archive