Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db47ece

Browse files
author
Jacek Gębal
committed
Update release process
1 parent 3b9d8d6 commit db47ece

2 files changed

Lines changed: 68 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
name: Build and deploy release
1+
name: Release
22

33
on:
4-
release:
5-
types: [ released ]
4+
workflow_dispatch:
5+
inputs:
6+
release_version:
7+
description: 'Release version (e.g. v3.2.01)'
8+
required: true
9+
next_snapshot:
10+
description: 'Next snapshot version (e.g. v3.2.02-SNAPSHOT)'
11+
required: true
612

713
defaults:
814
run:
915
shell: bash
1016

1117
jobs:
12-
build:
18+
release:
1319

1420
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write # needed to push tags and commits
1523
env:
1624
DB_URL: "//localhost:1521/FREEPDB1"
1725

@@ -30,9 +38,11 @@ jobs:
3038
--health-retries 10
3139
3240
steps:
33-
- uses: actions/checkout@v4
41+
- name: Checkout
42+
uses: actions/checkout@v4
3443
with:
35-
fetch-depth: 0
44+
fetch-depth: 0 # full history needed for tagging
45+
token: ${{ secrets.GITHUB_TOKEN }}
3646

3747
- name: Install utPLSQL
3848
run: sh ${{ github.workspace }}/scripts/1_install_utplsql.sh
@@ -51,6 +61,11 @@ jobs:
5161
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
5262
gpg-passphrase: MAVEN_GPG_PASSPHRASE
5363

64+
- name: Configure Git
65+
run: |
66+
git config user.name "github-actions[bot]"
67+
git config user.email "github-actions[bot]@users.noreply.github.com"
68+
5469
- name: Cache local Maven repository
5570
uses: actions/cache@v4
5671
with:
@@ -59,15 +74,53 @@ jobs:
5974
restore-keys: |
6075
${{ runner.os }}-maven-
6176
62-
- name: Maven deploy release
63-
run: mvn clean deploy -Prelease
77+
- name: Set release version
78+
run: mvn versions:set -DremoveSnapshot=true -DgenerateBackupPoms=false
79+
80+
- name: Set release version
81+
run: |
82+
mvn versions:set -DnewVersion=${{ inputs.release_version }} -DgenerateBackupPoms=false
83+
84+
- name: Build and test release
85+
run: mvn clean verify -Prelease
86+
87+
- name: Deploy to Maven Central / Nexus
88+
if: success()
89+
run: mvn deploy -Prelease --no-transfer-progress -DskipTests
6490
env:
65-
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
66-
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
91+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
92+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
6793
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
6894

6995
- name: Publish unit test results
7096
uses: EnricoMi/publish-unit-test-result-action@v2
7197
if: always()
7298
with:
7399
files: target/**/TEST**.xml
100+
101+
- name: Commit and tag release version
102+
run: |
103+
git add pom.xml "**/pom.xml"
104+
git commit -m "chore(release): release ${{ inputs.release_version }} [skip ci]"
105+
git tag -a "v${{ inputs.release_version }}" -m "Release ${{ inputs.release_version }}"
106+
107+
- name: Set next snapshot version
108+
run: |
109+
mvn versions:set -DnewVersion=${{ inputs.next_snapshot }} -DgenerateBackupPoms=false
110+
111+
- name: Commit next snapshot version
112+
run: |
113+
git add pom.xml "**/pom.xml"
114+
git commit -m "chore(release): bump to ${{ inputs.next_snapshot }} [skip ci]"
115+
116+
- name: Push commits and tag
117+
run: |
118+
git push origin HEAD:${{ github.ref_name }}
119+
git push origin "v${{ inputs.release_version }}"
120+
121+
- name: Create GitHub Release
122+
uses: softprops/action-gh-release@v2
123+
with:
124+
tag_name: "v${{ inputs.release_version }}"
125+
name: "Release ${{ inputs.release_version }}"
126+
generate_release_notes: true

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ If you want to skip the local database part, just run
2020
```bash
2121
./mvnw test
2222
```
23+
24+
### Publishing a new release
25+
26+
To publish a new release manually execute the [Release workflow](https://github.com/utPLSQL/utPLSQL-java-api/actions/workflows/release.yml).
27+
Provide correct versions for current release and next snapshot.

0 commit comments

Comments
 (0)