Skip to content

Commit 992f018

Browse files
author
Jacek Gębal
committed
Update release process
1 parent 666721f commit 992f018

1 file changed

Lines changed: 64 additions & 40 deletions

File tree

.github/workflows/release.yml

Lines changed: 64 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,52 @@
1-
name: Build and deploy release
1+
name: Release
22

33
on:
4-
push:
5-
branches: [ main ]
4+
workflow_dispatch:
5+
inputs:
6+
release_version:
7+
description: 'Release version (e.g. 3.2.3)'
8+
required: true
9+
next_snapshot:
10+
description: 'Next development version (default: auto-increment patch, e.g. 3.2.4) without the "-SNAPSHOT" word'
11+
required: false
612

7-
jobs:
8-
build:
13+
permissions:
14+
contents: write
15+
id-token: write
16+
attestations: write
917

10-
runs-on: ubuntu-latest
11-
env:
12-
UTPLSQL_VERSION: develop
13-
UTPLSQL_FILE: utPLSQL
14-
DB_URL: "//localhost:1521/FREEPDB1"
15-
DB_USER: APP
16-
DB_PASS: pass
18+
defaults:
19+
run:
20+
shell: bash
1721

18-
services:
19-
oracle:
20-
image: gvenzl/oracle-free:23-slim-faststart
21-
env:
22-
ORACLE_PASSWORD: oracle
23-
ports:
24-
- 1521:1521
25-
options: >-
26-
--health-cmd healthcheck.sh
27-
--health-interval 10s
28-
--health-timeout 5s
29-
--health-retries 10
30-
--name oracle
22+
jobs:
23+
release:
24+
runs-on: ubuntu-latest
3125

3226
steps:
3327
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
3430

35-
- name: Install utPLSQL
36-
run: .github/scripts/1_install_utplsql.sh
37-
38-
- name: Install demo project
39-
run: .github/scripts/2_install_demo_project.sh
40-
41-
- name: Set up JDK 17
31+
- name: Set up JDK
4232
uses: actions/setup-java@v5
4333
with:
44-
java-version: '17'
4534
distribution: 'temurin'
35+
java-version: '21'
36+
cache: 'maven'
4637
server-id: central
4738
server-username: MAVEN_USERNAME
4839
server-password: MAVEN_PASSWORD
4940
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
5041
gpg-passphrase: MAVEN_GPG_PASSPHRASE
5142

52-
- name: Cache local Maven repository
53-
uses: actions/cache@v4
54-
with:
55-
path: ~/.m2/repository
56-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
57-
restore-keys: |
58-
${{ runner.os }}-maven-
43+
- name: Configure Git
44+
run: |
45+
git config user.name "github-actions[bot]"
46+
git config user.email "github-actions[bot]@users.noreply.github.com"
47+
48+
- name: Set release version
49+
run: mvn versions:set -DnewVersion=${{ inputs.release_version }} -DgenerateBackupPoms=false
5950

6051
- name: Maven deploy release
6152
run: mvn clean deploy -Prelease
@@ -64,3 +55,36 @@ jobs:
6455
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
6556
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
6657

58+
- name: Commit and tag release version
59+
run: |
60+
git add pom.xml
61+
git commit -m "Release v${{ inputs.release_version }}"
62+
git tag -a "v${{ inputs.release_version }}" -m "Release ${{ inputs.release_version }}"
63+
64+
- name: Calculate and set next development version
65+
run: |
66+
if [[ -n "${{ inputs.next_snapshot }}" ]]; then
67+
NEXT="${{ inputs.next_snapshot }}-SNAPSHOT"
68+
else
69+
IFS='.' read -r major minor patch <<< "${{ inputs.release_version }}"
70+
NEXT="${major}.${minor}.$((patch + 1))-SNAPSHOT"
71+
fi
72+
mvn -B versions:set -DnewVersion="$NEXT" -DgenerateBackupPoms=false
73+
git add pom.xml
74+
git commit -m "Prepare next development version $NEXT [skip ci]"
75+
76+
- name: Push commits and tag
77+
run: |
78+
git push origin HEAD:${{ github.ref_name }}
79+
git push origin "v${{ inputs.release_version }}"
80+
81+
- name: Create GitHub Release
82+
uses: softprops/action-gh-release@v2
83+
with:
84+
tag_name: v${{ inputs.release_version }}
85+
name: "utPLSQL-cli v${{ inputs.release_version }}"
86+
generate_release_notes: true
87+
fail_on_unmatched_files: true
88+
files: |
89+
target/utPLSQL-cli.zip
90+
target/utPLSQL-cli.zip.sha256

0 commit comments

Comments
 (0)