Skip to content

Commit f4eb9fd

Browse files
committed
chore: improved release yml
1 parent 2a46387 commit f4eb9fd

File tree

1 file changed

+66
-35
lines changed

1 file changed

+66
-35
lines changed

.github/workflows/release.yml

Lines changed: 66 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
7-
81
name: Parsek Database Plugin Release
92

103
on:
@@ -18,10 +11,10 @@ jobs:
1811
get-next-version:
1912
runs-on: ubuntu-latest
2013
permissions:
21-
contents: write # to be able to publish a GitHub release
22-
issues: write # to be able to comment on released issues
23-
pull-requests: write # to be able to comment on released pull requests
24-
id-token: write # to enable use of OIDC for npm provenance
14+
contents: write
15+
issues: write
16+
pull-requests: write
17+
id-token: write
2518
steps:
2619
- uses: actions/checkout@v4
2720

@@ -37,23 +30,15 @@ jobs:
3730
env:
3831
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
3932

40-
- name: Echo new_tag_version
41-
run: |
42-
echo "Extracted Tag Version: ${{ steps.get-next-version.outputs.new_tag_version }}"
43-
env:
44-
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
4533
outputs:
4634
new_tag_version: ${{ steps.get-next-version.outputs.new_tag_version }}
4735

48-
build-and-release:
36+
build:
4937
runs-on: ubuntu-latest
5038
needs: get-next-version
51-
if: ${{needs.get-next-version.outputs.new_tag_version != ''}}
39+
if: ${{ needs.get-next-version.outputs.new_tag_version != '' }}
5240
permissions:
53-
contents: write # to be able to publish a GitHub release
54-
issues: write # to be able to comment on released issues
55-
pull-requests: write # to be able to comment on released pull requests
56-
id-token: write # to enable use of OIDC for npm provenance
41+
contents: write
5742
steps:
5843
- uses: actions/checkout@v4
5944

@@ -67,23 +52,74 @@ jobs:
6752

6853
- name: Build with Gradle
6954
run: |
70-
./gradlew build \
71-
-Pversion=${{ needs.get-next-version.outputs.new_tag_version }} \
72-
-PtimeStamp=${{ steps.time.outputs.time }}
55+
./gradlew build -Pversion=${{ needs.get-next-version.outputs.new_tag_version }}
56+
57+
- name: Upload build artifacts
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: build-artifacts
61+
path: build/libs/
62+
63+
gh-release:
64+
name: GH Release
65+
runs-on: ubuntu-latest
66+
needs: build
67+
if: ${{ needs.get-next-version.outputs.new_tag_version != '' }}
68+
permissions:
69+
contents: write
70+
issues: write
71+
pull-requests: write
72+
id-token: write
73+
steps:
74+
- uses: actions/checkout@v4
7375

7476
- name: Setup Node.js
7577
uses: actions/setup-node@v3
7678
with:
7779
node-version: "lts/*"
7880

79-
- name: Publish to Maven Central with JReleaser
81+
- name: Install deps for semantic-release
8082
run: |
81-
./gradlew -Pversion=${{ needs.get-next-version.outputs.new_tag_version }} publish
83+
npm ci
84+
# Eğer package.json yoksa bu adımı kaldırabilirsiniz
85+
86+
- name: Create GitHub Release with semantic-release
8287
env:
83-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
84-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
88+
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
89+
run: npx semantic-release
90+
91+
maven-central-deploy:
92+
name: Maven Central Deploy
93+
runs-on: ubuntu-latest
94+
needs: [ get-next-version, build, gh-release ]
95+
if: ${{ needs.get-next-version.outputs.new_tag_version != '' }}
96+
permissions:
97+
contents: write
98+
issues: write
99+
pull-requests: write
100+
id-token: write
101+
steps:
102+
- uses: actions/checkout@v4
103+
104+
- uses: actions/setup-java@v4
105+
with:
106+
distribution: temurin
107+
java-version: 21
108+
109+
- name: Setup Gradle
110+
uses: gradle/actions/setup-gradle@v4
111+
112+
- name: Download build artifacts
113+
uses: actions/download-artifact@v4
114+
with:
115+
name: build-artifacts
116+
path: build/libs/
117+
118+
- name: Verify downloaded artifacts
119+
run: ls -R build/libs
85120

86121
- name: Deploy to Maven Central with JReleaser
122+
id: jreleaser
87123
run: |
88124
./gradlew -Pversion=${{ needs.get-next-version.outputs.new_tag_version }} jreleaserDeploy
89125
env:
@@ -94,16 +130,11 @@ jobs:
94130
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
95131
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
96132

97-
- name: JReleaser output
133+
- name: Upload JReleaser logs
98134
if: always()
99135
uses: actions/upload-artifact@v4
100136
with:
101137
name: jreleaser-logs
102138
path: |
103139
build/jreleaser/trace.log
104140
build/jreleaser/output.properties
105-
106-
- name: Release
107-
env:
108-
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
109-
run: npx semantic-release

0 commit comments

Comments
 (0)