Repository navigation
76 lines (65 loc) · 2.14 KB
/
Copy pathmaven-publish.yml
File metadata and controls
76 lines (65 loc) · 2.14 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
name: Publish New Version
on:
workflow_dispatch:
jobs:
build:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: 1. Checkout main
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: 2. Set up JDK 16
uses: actions/setup-java@v6
with:
java-version: '16'
distribution: 'corretto'
cache: maven
- name: 3. Create Versions
id: version
uses: PaulHatch/semantic-version@v6.0.2
with:
tag_prefix: ""
major_pattern: "/MAJOR.*/"
minor_pattern: "/MINOR.*/"
format: "${major}.${minor}.${patch}"
namespace: Release
change_path: "."
short_tags: false
bump_each_commit: false
- name: 4. Update version in pom.xml (Release only)
run: mvn versions:set -DnewVersion=${{steps.version.outputs.version_tag}} -DgenerateBackupPoms=false
- name: 5. Build with Maven
run: mvn package -P publish --file pom.xml
- name: 6. Prepare release files
run: |
mkdir -p staging
cp "Client/target/Client-${{ steps.version.outputs.version_tag }}-all.jar" staging/
- name: 7. Upload build artifact
uses: actions/upload-artifact@v7
with:
name: ${{ steps.version.outputs.version_tag }}
path: staging
- name: 8. Commit & push version change
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add pom.xml
git add '**/pom.xml'
git commit -m "Update version to ${{ steps.version.outputs.version_tag }}"
git push origin HEAD:${{ github.ref_name }}
- name: 9. Create Git tag
run: |
git tag "${{ steps.version.outputs.version_tag }}"
git push origin "${{ steps.version.outputs.version_tag }}"
- name: 10. Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create \
"${{ steps.version.outputs.version_tag }}" \
staging/*.jar \
--title "${{ steps.version.outputs.version_tag }}" \
--generate-notes \
--verify-tag