-
Notifications
You must be signed in to change notification settings - Fork 305
84 lines (72 loc) · 2.76 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
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Maven Package
on:
push:
tags:
- '*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: version
id: version
run: echo "version=$(git describe --tags --abbrev=1)" >> $GITHUB_OUTPUT
- name: changelog
id: changelog
run: echo "changelog=$(git log --oneline ${{ github.event.before }}..HEAD)" >> $GITHUB_OUTPUT
# - name: 1. Import GPG key
# id: import_gpg
# uses: crazy-max/ghaction-import-gpg@v4
# with:
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
# passphrase: ${{ secrets.GPG_PASS_PHRASE }}
# git-user-signingkey: true
# git-commit-gpgsign: true
- name: 2. Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.8.8
- name: 4. Set up JDK
uses: actions/setup-java@v4.4.0
with:
java-version: '8'
distribution: 'adopt'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: 5. Build and packaging
run: |
mvn -B -V -T 1 -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dgpg.skip=true clean package
mvn package assembly:single
bash shrink_package.sh y
- name: 6. Calculate SHA256SUM
run: |
cd target/addax
sha256sum addax-${{ steps.version.outputs.version }}.tar.gz > addax-${{ steps.version.outputs.version }}.tar.gz.sha256sum.asc
- name: 7. Create release page
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
body: |
# Addax ${{ steps.version.outputs.version }} has released! 🎉
## Changes
${{ steps.changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: 8. Upload to GitHub
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/addax/addax-${{ steps.version.outputs.version }}.tar.gz
target/addax/addax-${{ steps.version.outputs.version }}.tar.gz.sha256sum.asc
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}