Skip to content

Commit fdb8a35

Browse files
authored
Create release-to-maven-central.yml
1 parent 045f131 commit fdb8a35

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: release-to-maven-central
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseversion:
7+
description: 'Release version'
8+
required: true
9+
default: '2.4.0'
10+
11+
jobs:
12+
publish-central-and-pages:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- run: echo "Will start a Maven Central upload with version ${{ github.event.inputs.releaseversion }}"
16+
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up settings.xml for Maven Central Repository
20+
uses: actions/setup-java@v3
21+
with:
22+
distribution: 'temurin'
23+
java-version: '8'
24+
server-id: oss.sonatype.org
25+
server-username: MAVEN_USERNAME
26+
server-password: MAVEN_PASSWORD
27+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
28+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
29+
30+
- name: Cache local Maven repository
31+
uses: actions/[email protected]
32+
env:
33+
cache-name: cache-mvn
34+
with:
35+
path: ~/.m2/repository
36+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
37+
restore-keys: |
38+
${{ runner.os }}-build-${{ env.cache-name }}-
39+
${{ runner.os }}-build-
40+
${{ runner.os }}-
41+
42+
- name: Cache node modules
43+
uses: actions/cache@v2
44+
env:
45+
cache-name: cache-node-modules
46+
with:
47+
path: ~/.npm
48+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
49+
restore-keys: |
50+
${{ runner.os }}-build-${{ env.cache-name }}-
51+
52+
- name: Set projects Maven version to GitHub Action GUI set version
53+
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress
54+
55+
- name: Publish package
56+
run: mvn --batch-mode clean deploy --no-transfer-progress -P central-deploy -DskipTests=true
57+
env:
58+
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
59+
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
60+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
61+
62+
- name: Deploy Asciidoc docs output to GitHub Pages
63+
uses: JamesIves/[email protected]
64+
with:
65+
branch: gh-pages # The branch the action should deploy to.
66+
folder: batch-web-spring-boot-docs/target/generated-docs # The folder the action should deploy.
67+
target-folder: ${{ github.event.inputs.releaseversion }}
68+
clean: true # Automatically remove deleted files from the deploy branch
69+
70+
71+
publish-github-release:
72+
needs: publish-central-and-pages
73+
runs-on: ubuntu-latest
74+
75+
steps:
76+
- uses: actions/checkout@v3
77+
78+
- name: Generate changelog
79+
id: changelog
80+
uses: metcalfc/[email protected]
81+
with:
82+
myToken: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: Create GitHub Release
85+
id: create_release
86+
uses: actions/create-release@v1
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
tag_name: ${{ github.event.inputs.releaseversion }}
91+
release_name: ${{ github.event.inputs.releaseversion }}
92+
body: |
93+
Grab the new version from Maven central https://repo1.maven.org/maven2/de/codecentric/
94+
95+
Current docs at https://codecentric.github.io/spring-boot-starter-batch-web/${{ github.event.inputs.releaseversion }}/
96+
97+
### Things that changed in this release
98+
${{ steps.changelog.outputs.changelog }}
99+
draft: false
100+
prerelease: ${{ contains(github.event.inputs.releaseversion, '-') }}

0 commit comments

Comments
 (0)