Skip to content

Commit 1d097e5

Browse files
New release script (#287)
* New release script * Added permission for GITHUB_TOKEN
1 parent 9116655 commit 1d097e5

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/release_new.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Master release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseVersion:
7+
description: 'Release and tag version (ie 5.5.0)'
8+
required: true
9+
developmentVersion:
10+
description: 'Next development version, with SNAPSHOT'
11+
required: true
12+
13+
jobs:
14+
master_release:
15+
if: "!contains(github.event.head_commit.message, '[maven-release-plugin]')"
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: write
20+
packages: write
21+
attestations: write
22+
id-token: write
23+
pull-requests: write
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
# Fetch all history for all tags and branches
30+
fetch-depth: 0
31+
# Use PAT instead of the default GITHUB_TOKEN for authentication
32+
token: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }}
33+
34+
- name: Set up JDK 11
35+
uses: actions/setup-java@v4
36+
with:
37+
java-version: '11'
38+
distribution: 'temurin'
39+
40+
- name: Initialize mandatory git config
41+
run: |
42+
git config user.name "GitHub Actions"
43+
git config user.email [email protected]
44+
45+
- name: Configure Git HTTPS authentication
46+
run: |
47+
git config --global url."https://${{ secrets.GH_PACKAGE_REPO_PASSWORD }}@github.com/".insteadOf "[email protected]:"
48+
git remote set-url origin https://${{ secrets.GH_PACKAGE_REPO_PASSWORD }}@github.com/${{ github.repository }}.git
49+
50+
- name: Release with Maven
51+
env:
52+
GITHUB_USERNAME: ${{ github.actor }}
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
GH_PACKAGE_REPO_PASSWORD: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }}
55+
run: |
56+
mvn -B -Dtag=${{ github.event.inputs.releaseVersion }} release:prepare \
57+
-DreleaseVersion=${{ github.event.inputs.releaseVersion }} \
58+
-DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} --file pom.xml \
59+
&& mvn release:perform -B --file pom.xml
60+
61+
- name: Create A Pull Request
62+
uses: thomaseizinger/[email protected]
63+
with:
64+
github_token: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }}
65+
head: master
66+
base: develop
67+
title: Released master into develop
68+
body: |
69+
Hi!
70+
This PR was created in response workflow running.
71+
I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}.

0 commit comments

Comments
 (0)