-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.87 KB
/
deploy-release.yaml
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
79
80
81
name: Build Release
on:
push:
branches:
- main
- test
permissions:
contents: write
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v1
# OLD CODE:
#- name: Build and Test
# uses: qcastel/github-actions-maven-cmd@master
# env:
# api_key: ${{ secrets.API_KEY }}
# with:
# maven-args: "clean package"
#- name: Release
# uses: qcastel/github-actions-maven-release@master
# env:
# JAVA_HOME: /usr/lib/jvm/java-1.8-openjdk/
# with:
# git-release-bot-name: "bot-idhub"
# git-release-bot-email: "[email protected]"
# release-branch-name: main
# version-patch: true
# maven-development-version-number: ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextPatchVersion}-SNAPSHOT
# maven-release-version-number: ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.patchVersion}
# maven-args: "-Dmaven.javadoc.skip=true -DskipTests -DskipITs -Dmaven.deploy.skip=true -Dmaven.site.skip=true"
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# NEW CODE:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn clean compile assembly:single package
env:
api_key: ${{ secrets.API_KEY }}
- name: Get Project Version
run: echo "PROJECT_VERSION=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }'`" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: joutvhu/create-release@v1
with:
tag_name: v${{env.PROJECT_VERSION}}
name: Release ${{env.PROJECT_VERSION}}
draft: true
prerelease: false
remove_assets: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
with:
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
asset_path: ./target/modupdater-${{env.PROJECT_VERSION}}-jar-with-dependencies.jar
asset_name: modupdater-${{env.PROJECT_VERSION}}-jar-with-dependencies.jar
asset_content_type: application/java-archive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}