-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (74 loc) · 2.83 KB
/
maven.yml
File metadata and controls
85 lines (74 loc) · 2.83 KB
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
82
83
84
85
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
env:
key1: ${{secrets.WORKFLOW_TOKEN}}
runs-on: ubuntu-latest
steps:
- run: echo $key1
- uses: actions/checkout@v2
- name: Set up JDK 1.11
uses: joschi/setup-jdk@v1
with:
java-version: '11'
# - name: replace group id
# if: success()
# run: find . -name "pom.xml" | xargs sed -i "s/<groupId>com.cloudimpl<\/groupId>/<groupId>com.github.cloudimpl<\/groupId>/g"
- name: Extract ERRCODE_VERSION
if: success()
run: |
export VERSION=`cat pom.xml | grep "<version>" | head -n 1 | awk -F'>' '{print $2}' | awk -F'<' '{print $1}'` && echo "::set-env name=ERRCODE_VERSION::${VERSION}.${GITHUB_RUN_NUMBER}"
echo $ERRCODE_VERSION
- name: Set errcode build number
if: success()
run: mvn versions:set versions:commit -DnewVersion="${ERRCODE_VERSION}"
# - name: Build with Maven
# run: |
# mvn -B package --file pom.xml
# mvn clean install
# - name: Publish to GitHub Packages Apache Maven
# env:
# GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
# run: |
# echo "<settings><servers><server><id>github</id><username>nuwansa</username><password>${GITHUB_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml
# mvn deploy
- name: Release Maven package
uses: samuelmeuli/action-maven-publish@v1
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSWORD }}
nexus_username: ${{ secrets.OSSRH_USERNAME }}
nexus_password: ${{ secrets.OSSRH_TOKEN }}
# - name: Set up Maven Central Repository
# if: success()
# uses: actions/setup-java@v1
# with:
# java-version: 1.11
# server-id: ossrh
# server-username: MAVEN_USERNAME
# server-password: MAVEN_PASSWORD
# - name: Publish package
# run: mvn -B deploy
# env:
# MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
- name: Create Release
if: success() && github.event_name == 'push'
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
with:
tag_name: ${{ env.ERRCODE_VERSION }}
release_name: ${{ env.ERRCODE_VERSION }} - ${{ github.event.head_commit.message }}
body: |
Automated release
draft: false
prerelease: false