|
1 | | -name: Build and deploy release |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | 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 |
6 | 12 |
|
7 | | -jobs: |
8 | | - build: |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + id-token: write |
| 16 | + attestations: write |
9 | 17 |
|
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 |
17 | 21 |
|
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 |
31 | 25 |
|
32 | 26 | steps: |
33 | 27 | - uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
34 | 30 |
|
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 |
42 | 32 | uses: actions/setup-java@v5 |
43 | 33 | with: |
44 | | - java-version: '17' |
45 | 34 | distribution: 'temurin' |
| 35 | + java-version: '21' |
| 36 | + cache: 'maven' |
46 | 37 | server-id: central |
47 | 38 | server-username: MAVEN_USERNAME |
48 | 39 | server-password: MAVEN_PASSWORD |
49 | 40 | gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} |
50 | 41 | gpg-passphrase: MAVEN_GPG_PASSPHRASE |
51 | 42 |
|
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 |
59 | 50 |
|
60 | 51 | - name: Maven deploy release |
61 | 52 | run: mvn clean deploy -Prelease |
|
64 | 55 | MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
65 | 56 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |
66 | 57 |
|
| 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