forked from fegorama/alfviral
-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (121 loc) · 4.87 KB
/
maven-publish.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# This workflow will build a package using Maven
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
name: Maven Package
on:
push:
branches:
- master
tags:
- '*' # Triggers releases for tags
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
server-id: github
settings-path: ${{ github.workspace }}
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# Run the multi-module Maven build from the main pom.xml
- name: Build all modules with Maven
run: mvn -B package --file pom.xml
# Upload artifacts as build artifacts
- name: Archive alfviral-platform assets
uses: actions/upload-artifact@v4
with:
name: alfviral-platform
path: |
alfviral-platform/target/alfviral-platform-*.jar
alfviral-platform/target/alfviral-platform-*.amp
!alfviral-platform/target/*-tests.jar
- name: Archive alfviral-share assets
uses: actions/upload-artifact@v4
with:
name: alfviral-share
path: |
alfviral-share/target/alfviral-share-*.jar
alfviral-share/target/alfviral-share-*.amp
!alfviral-share/target/*-tests.jar
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download alfviral-platform artifact
uses: actions/download-artifact@v4
with:
name: alfviral-platform
- name: Download alfviral-share artifact
uses: actions/download-artifact@v4
with:
name: alfviral-share
- name: Install xmllint
run: |
sudo apt-get update
sudo apt-get install -y libxml2-utils
- name: Extract version from alfviral-platform/pom.xml
id: extract_platform_version
run: |
PLATFORM_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' alfviral-platform/pom.xml)
echo "PLATFORM_VERSION=${PLATFORM_VERSION}" >> $GITHUB_ENV
- name: Extract version from alfviral-share/pom.xml
id: extract_share_version
run: |
SHARE_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' alfviral-share/pom.xml)
echo "SHARE_VERSION=${SHARE_VERSION}" >> $GITHUB_ENV
- name: Create GitHub Release with Auto-generated Release Notes
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
generateReleaseNotes: true
name: "Release ${{ github.ref_name }}"
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
# Upload artifacts as release assets using v2
- name: Upload alfviral-platform .jar asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: alfviral-platform-${{env.PLATFORM_VERSION}}.jar
asset_name: alfviral-platform-${{ github.ref_name }}.jar
asset_content_type: application/java-archive
- name: Upload alfviral-platform .amp asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: alfviral-platform-${{env.PLATFORM_VERSION}}.amp
asset_name: alfviral-platform-${{ github.ref_name }}.amp
asset_content_type: application/octet-stream # or application/zip based on your preference
- name: Upload alfviral-share .jar asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: alfviral-share-${{env.SHARE_VERSION}}.jar
asset_name: alfviral-share-${{ github.ref_name }}.jar
asset_content_type: application/java-archive
- name: Upload alfviral-share .amp asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: alfviral-share-${{env.SHARE_VERSION}}.amp
asset_name: alfviral-share-${{ github.ref_name }}.amp
asset_content_type: application/octet-stream # or application/zip based on your preference