Skip to content

Commit d059c34

Browse files
committed
Add automatic release creation to GitHub Actions
1 parent 6adc6df commit d059c34

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/workflows/maven.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ name: Build and Publish
33
on:
44
push:
55
branches: [ main ]
6+
tags:
7+
- 'v*'
68
pull_request:
79
branches: [ main ]
810

911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
1214
permissions:
13-
contents: read
15+
contents: write
1416
packages: write
1517
steps:
1618
- uses: actions/checkout@v4
@@ -22,10 +24,23 @@ jobs:
2224
- name: Build
2325
run: mvn clean verify -Dmaven.javadoc.skip=true
2426
- name: Publish Package
25-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
27+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
2628
run: mvn deploy -X -Dmaven.javadoc.skip=true -s .github/settings.xml
2729
env:
2830
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2931
GITHUB_ACTOR: ${{ github.actor }}
3032
MAVEN_USERNAME: ${{ github.actor }}
31-
MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
33+
MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Create Release
35+
if: startsWith(github.ref, 'refs/tags/')
36+
uses: softprops/action-gh-release@v1
37+
with:
38+
files: |
39+
target/*.jar
40+
target/*.pom
41+
target/*.asc
42+
target/*.md5
43+
target/*.sha1
44+
generate_release_notes: true
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)