Repository navigation
98 lines (74 loc) · 2.45 KB
/
Copy pathrelease.yml
File metadata and controls
98 lines (74 loc) · 2.45 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
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Release
on:
push:
branches:
- main
jobs:
generate-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.out.outputs.version }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk
- id: pr
uses: actions-ecosystem/action-get-merged-pull-request@v1.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: zwaldowski/semver-release-action@v2
with:
dry_run: true
bump: patch
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set version output
id: out
run: echo "::set-output name=version::$(echo ${VERSION})"
build-and-deploy:
needs: [ "generate-version" ]
runs-on: ubuntu-latest
environment: SONATYPE_ORG_USERNAME
steps:
- uses: actions/checkout@v2
- uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_SECRET_KEY }}
passphrase: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
git_user_signingkey: true
git_commit_gpgsign: true
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21
cache: maven
server-id: sonatype.org
server-username: SONATYPE_ORG_USERNAME
server-password: SONATYPE_ORG_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Set version
run: |
mvn versions:set -DnewVersion=${{ needs.generate-version.outputs.version }}
- name: Run tests
run: |
mvn clean test
- name: Build and release it
env:
SONATYPE_ORG_USERNAME: ${{ secrets.SONATYPE_ORG_USERNAME }}
SONATYPE_ORG_PASSWORD: ${{ secrets.SONATYPE_ORG_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
run: |
mvn deploy -Prelease -Dgpg.keyname=563C5DE0C079D6AD
git-release:
needs: [ "generate-version", "build-and-deploy" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ needs.generate-version.outputs.version }}
prerelease: false
title: ${{ needs.generate-version.outputs.version }}