Repository navigation
135 lines (115 loc) · 4.25 KB
/
Copy pathrelease.yml
File metadata and controls
135 lines (115 loc) · 4.25 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Release
on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version (e.g. 3.2.3)'
required: true
next_snapshot:
description: 'Next development version (default: auto-increment patch,e.g. 3.2.4) without the "-SNAPSHOT" word'
required: false
permissions:
contents: write
id-token: write
attestations: write
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # needed to push tags and commits
env:
DB_URL: "//localhost:1521/FREEPDB1"
services:
oracle:
image: gvenzl/oracle-free:23-slim-faststart
env:
ORACLE_PASSWORD: oracle
SERVICE_NAME: FREEPDB1
ports:
- 1521:1521
options: >-
--health-cmd healthcheck.sh
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # full history needed for tagging
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install utPLSQL
run: sh ${{ github.workspace }}/scripts/1_install_utplsql.sh
- name: Install demo project
run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set release version
run: mvn versions:set -DnewVersion=${{ inputs.release_version }} -DgenerateBackupPoms=false
- name: Build and test release
run: mvn clean verify -Prelease
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Deploy to Maven Central / Nexus
if: success()
run: mvn deploy -Prelease --no-transfer-progress -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Commit and tag release version
run: |
git add pom.xml
git commit -m "Release ${{ inputs.release_version }} [skip ci]"
git tag -a "v${{ inputs.release_version }}" -m "Release ${{ inputs.release_version }}"
- name: Calculate and set next development version
run: |
if [[ -n "${{ inputs.next_snapshot }}" ]]; then
NEXT="${{ inputs.next_snapshot }}-SNAPSHOT"
else
IFS='.' read -r major minor patch <<< "${{ inputs.release_version }}"
NEXT="${major}.${minor}.$((patch + 1))-SNAPSHOT"
fi
mvn -B versions:set -DnewVersion="$NEXT" -DgenerateBackupPoms=false
git add pom.xml
git commit -m "Prepare next development version $NEXT [skip ci]"
- name: Push commits and tag
run: |
git push origin HEAD:${{ github.ref_name }}
git push origin "v${{ inputs.release_version }}"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ inputs.release_version }}"
name: "Release ${{ inputs.release_version }}"
generate_release_notes: true
- name: Announce release in org discussions and on utplsql.github.io
uses: utPLSQL/.github/actions/announce-release@v1
with:
project-name: utPLSQL-java-api
tag: v${{ inputs.release_version }}
discussion-token: ${{ secrets.API_TOKEN_GITHUB }}
site-token: ${{ secrets.API_TOKEN_GITHUB }}
site-category: utplsql-java-api