Skip to content

Commit dc8b839

Browse files
Merge pull request #13 from logdash-io/release/0.2.0
Release/0.2.0
2 parents e438229 + fddecf2 commit dc8b839

27 files changed

Lines changed: 1347 additions & 73 deletions

File tree

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: CI/CD Pipeline
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, dev ]
66
tags: [ 'v*' ]
77
pull_request:
8-
branches: [ main ]
8+
branches: [ main, dev ]
99

1010
permissions:
1111
contents: write
@@ -263,12 +263,9 @@ jobs:
263263
exit 1
264264
fi
265265
266-
- name: Check if version exists
266+
- name: Check if version exists in GitHub Packages
267267
run: |
268-
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
269-
echo "version=$VERSION" >> $GITHUB_OUTPUT
270-
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
271-
268+
VERSION=${{ steps.version.outputs.version }}
272269
# Check if version already exists in GitHub Packages
273270
if gh api /orgs/logdash-io/packages/maven/io.logdash.logdash/versions --jq '.[] | .name' | grep -q "^$VERSION$"; then
274271
echo "::warning::Version $VERSION already exists in GitHub Packages"
@@ -346,6 +343,21 @@ jobs:
346343
exit 1
347344
fi
348345
346+
- name: Check if version exists on Maven Central
347+
run: |
348+
VERSION=${{ steps.version.outputs.version }}
349+
# Check if version exists on Maven Central using search API
350+
SEARCH_RESULT=$(curl -s "https://search.maven.org/solrsearch/select?q=g:io.logdash+AND+a:logdash+AND+v:$VERSION&rows=1&wt=json")
351+
COUNT=$(echo "$SEARCH_RESULT" | jq -r '.response.numFound')
352+
353+
if [[ "$COUNT" != "0" ]]; then
354+
echo "::error::Version $VERSION already exists on Maven Central"
355+
echo "Cannot redeploy existing version to Maven Central"
356+
exit 1
357+
else
358+
echo "βœ… Version $VERSION is available for Maven Central release"
359+
fi
360+
349361
- name: Build and Deploy to Maven Central
350362
run: |
351363
mvn clean deploy -B --no-transfer-progress \
@@ -356,12 +368,24 @@ jobs:
356368
CENTRAL_TOKEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
357369
CENTRAL_TOKEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
358370
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
371+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
372+
373+
- name: Verify Maven Central Deployment
374+
run: |
375+
VERSION=${{ steps.version.outputs.version }}
376+
# Check if artifact appears in Central Portal (deployment confirmation)
377+
if curl -s -f "https://central.sonatype.com/api/internal/browse/component?namespace=io.logdash&name=logdash&version=$VERSION" > /dev/null; then
378+
echo "βœ… Deployment confirmed via Central Portal API"
379+
else
380+
echo "⚠️ Not yet visible via Central Portal API (may take time to propagate)"
381+
fi
359382
360383
- name: Notify Maven Central Success
361384
run: |
362385
echo "βœ… Successfully deployed logdash:${{ steps.version.outputs.version }} to Maven Central"
363386
echo "πŸ“¦ Will be available at: https://central.sonatype.com/artifact/io.logdash/logdash/${{ steps.version.outputs.version }}"
364387
echo "🌐 Maven Central: https://search.maven.org/artifact/io.logdash/logdash/${{ steps.version.outputs.version }}"
388+
echo "⏱️ Note: It may take up to 2 hours for the artifact to be searchable via Maven Central"
365389
366390
create-github-release:
367391
name: Create GitHub Release
@@ -469,6 +493,14 @@ jobs:
469493
470494
_See below for full release notes and change log._
471495
496+
- name: Deployment Summary
497+
run: |
498+
echo "πŸ“‹ Deployment Status Summary:"
499+
echo "βœ… GitHub Packages: ${{ needs.github-release.result }}"
500+
echo "βœ… Maven Central: ${{ needs.maven-central-release.result }}"
501+
echo "πŸ“¦ Version: ${{ steps.version.outputs.version }}"
502+
echo "πŸ”— Maven Central: https://central.sonatype.com/artifact/io.logdash/logdash/${{ steps.version.outputs.version }}"
503+
472504
notification:
473505
name: Notification
474506
runs-on: ubuntu-latest
Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
name: Develop Branch Snapshots
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
schedule:
7+
- cron: '0 2 * * *'
8+
workflow_dispatch:
9+
10+
env:
11+
JAVA_VERSION: '17'
12+
JAVA_DISTRIBUTION: 'temurin'
13+
14+
jobs:
15+
validate-develop:
16+
runs-on: ubuntu-latest
17+
if: github.ref == 'refs/heads/develop'
18+
timeout-minutes: 15
19+
outputs:
20+
snapshot-version: ${{ steps.version.outputs.snapshot-version }}
21+
22+
steps:
23+
- name: Checkout develop
24+
uses: actions/checkout@v4
25+
with:
26+
ref: develop
27+
fetch-depth: 0
28+
29+
- name: Setup JDK ${{ env.JAVA_VERSION }}
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: ${{ env.JAVA_VERSION }}
33+
distribution: ${{ env.JAVA_DISTRIBUTION }}
34+
35+
- name: Cache Maven dependencies
36+
uses: actions/cache@v3
37+
with:
38+
path: ~/.m2/repository
39+
key: ${{ runner.os }}-maven-develop-${{ hashFiles('**/pom.xml') }}
40+
restore-keys: |
41+
${{ runner.os }}-maven-develop-
42+
${{ runner.os }}-maven-
43+
44+
- name: Verify snapshot version
45+
id: version
46+
run: |
47+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
48+
if [[ ! $VERSION =~ .*-SNAPSHOT$ ]]; then
49+
echo "❌ Error: Develop branch must have SNAPSHOT version, found: $VERSION"
50+
exit 1
51+
fi
52+
echo "βœ… Snapshot version verified: $VERSION"
53+
echo "snapshot-version=$VERSION" >> $GITHUB_OUTPUT
54+
55+
- name: Run quick validation
56+
run: |
57+
mvn clean validate compile -B --no-transfer-progress \
58+
-DskipTests=true \
59+
-Dspotless.check.skip=true
60+
61+
maven-central-snapshot:
62+
runs-on: ubuntu-latest
63+
needs: validate-develop
64+
timeout-minutes: 25
65+
if: github.ref == 'refs/heads/develop'
66+
67+
steps:
68+
- name: Checkout develop
69+
uses: actions/checkout@v4
70+
with:
71+
ref: develop
72+
fetch-depth: 0
73+
74+
- name: Setup JDK ${{ env.JAVA_VERSION }}
75+
uses: actions/setup-java@v4
76+
with:
77+
java-version: ${{ env.JAVA_VERSION }}
78+
distribution: ${{ env.JAVA_DISTRIBUTION }}
79+
80+
- name: Cache Maven dependencies
81+
uses: actions/cache@v3
82+
with:
83+
path: ~/.m2/repository
84+
key: ${{ runner.os }}-maven-develop-${{ hashFiles('**/pom.xml') }}
85+
restore-keys: |
86+
${{ runner.os }}-maven-develop-
87+
${{ runner.os }}-maven-
88+
89+
- name: Configure Maven Central Snapshots
90+
uses: whelk-io/maven-settings-xml-action@v22
91+
with:
92+
servers: |
93+
[
94+
{
95+
"id": "central",
96+
"username": "${{ secrets.CENTRAL_TOKEN_USERNAME }}",
97+
"password": "${{ secrets.CENTRAL_TOKEN_PASSWORD }}"
98+
}
99+
]
100+
101+
- name: Display snapshot version
102+
run: |
103+
echo "πŸ“¦ Deploying snapshot version: ${{ needs.validate-develop.outputs.snapshot-version }}"
104+
105+
- name: Run comprehensive tests
106+
run: |
107+
mvn clean verify -B --no-transfer-progress \
108+
-Dmaven.test.failure.ignore=false \
109+
-Dfailsafe.rerunFailingTestsCount=2
110+
111+
- name: Deploy to Maven Central Snapshots
112+
run: |
113+
mvn deploy -B --no-transfer-progress \
114+
-Pmaven-central-release \
115+
-DskipTests=true \
116+
-Dcentral.autoPublish=true
117+
env:
118+
SONATYPE_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
119+
SONATYPE_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
120+
121+
- name: Verify Maven Central snapshot deployment
122+
run: |
123+
VERSION="${{ needs.validate-develop.outputs.snapshot-version }}"
124+
echo "⏳ Waiting for snapshot propagation..."
125+
sleep 10
126+
127+
# Check if snapshot metadata is available
128+
METADATA_URL="https://central.sonatype.com/repository/maven-snapshots/io/logdash/logdash/$VERSION/maven-metadata.xml"
129+
if curl -s -f "$METADATA_URL" > /dev/null; then
130+
echo "βœ… Snapshot metadata confirmed at Maven Central"
131+
else
132+
echo "⚠️ Snapshot metadata not yet available (may take time to propagate)"
133+
fi
134+
135+
- name: Display deployment info
136+
run: |
137+
VERSION="${{ needs.validate-develop.outputs.snapshot-version }}"
138+
echo "βœ… Successfully deployed $VERSION to Maven Central Snapshots"
139+
echo "πŸ“¦ Available at: https://central.sonatype.com/repository/maven-snapshots/io/logdash/logdash/$VERSION/"
140+
echo ""
141+
echo "πŸ” Maven dependency:"
142+
echo "<dependency>"
143+
echo " <groupId>io.logdash</groupId>"
144+
echo " <artifactId>logdash</artifactId>"
145+
echo " <version>$VERSION</version>"
146+
echo "</dependency>"
147+
echo ""
148+
echo "πŸ” Gradle dependency:"
149+
echo "implementation 'io.logdash:logdash:$VERSION'"
150+
151+
- name: Notify deployment status
152+
if: failure()
153+
run: |
154+
VERSION="${{ needs.validate-develop.outputs.snapshot-version }}"
155+
echo "❌ Snapshot deployment failed for version $VERSION"
156+
echo "Check logs above for deployment errors"
157+
158+
github-packages-snapshot:
159+
runs-on: ubuntu-latest
160+
needs: validate-develop
161+
timeout-minutes: 15
162+
if: github.ref == 'refs/heads/develop'
163+
164+
permissions:
165+
contents: read
166+
packages: write
167+
168+
steps:
169+
- name: Checkout develop
170+
uses: actions/checkout@v4
171+
with:
172+
ref: develop
173+
174+
- name: Setup JDK ${{ env.JAVA_VERSION }}
175+
uses: actions/setup-java@v4
176+
with:
177+
java-version: ${{ env.JAVA_VERSION }}
178+
distribution: ${{ env.JAVA_DISTRIBUTION }}
179+
180+
- name: Cache Maven dependencies
181+
uses: actions/cache@v3
182+
with:
183+
path: ~/.m2/repository
184+
key: ${{ runner.os }}-maven-develop-${{ hashFiles('**/pom.xml') }}
185+
restore-keys: |
186+
${{ runner.os }}-maven-develop-
187+
${{ runner.os }}-maven-
188+
189+
- name: Configure Maven Settings for GitHub Packages
190+
uses: whelk-io/maven-settings-xml-action@v22
191+
with:
192+
servers: |
193+
[
194+
{
195+
"id": "github",
196+
"username": "${env.GITHUB_ACTOR}",
197+
"password": "${env.GITHUB_TOKEN}"
198+
}
199+
]
200+
201+
- name: Deploy to GitHub Packages (Backup)
202+
run: |
203+
mvn deploy -B --no-transfer-progress \
204+
-Pgithub-release \
205+
-DperformRelease=true \
206+
-DskipTests=true
207+
env:
208+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
209+
210+
- name: Verify GitHub Packages deployment
211+
run: |
212+
VERSION="${{ needs.validate-develop.outputs.snapshot-version }}"
213+
echo "βœ… Backup snapshot deployed to GitHub Packages: $VERSION"
214+
echo "πŸ“¦ Available at: https://github.com/logdash-io/java-sdk/packages"
215+
216+
verify-deployments:
217+
runs-on: ubuntu-latest
218+
needs: [ maven-central-snapshot, github-packages-snapshot ]
219+
timeout-minutes: 10
220+
if: github.ref == 'refs/heads/develop'
221+
222+
steps:
223+
- name: Final verification
224+
run: |
225+
VERSION="${{ needs.validate-develop.outputs.snapshot-version }}"
226+
echo "πŸ” Final verification for snapshot: $VERSION"
227+
228+
# Wait a bit more for propagation
229+
echo "⏳ Waiting for complete propagation..."
230+
sleep 10
231+
232+
# Check Maven Central snapshots
233+
METADATA_URL="https://central.sonatype.com/repository/maven-snapshots/io/logdash/logdash/$VERSION/maven-metadata.xml"
234+
if curl -s -f "$METADATA_URL" > /dev/null; then
235+
echo "βœ… Maven Central snapshot confirmed and accessible"
236+
else
237+
echo "⚠️ Maven Central snapshot metadata not accessible yet"
238+
fi
239+
240+
echo ""
241+
echo "πŸ“‹ Deployment Summary:"
242+
echo "πŸ—οΈ Maven Central Snapshots: ${{ needs.maven-central-snapshot.result }}"
243+
echo "πŸ“¦ GitHub Packages: ${{ needs.github-packages-snapshot.result }}"
244+
echo "πŸ”’ Version: $VERSION"
245+
echo "🌐 Repository: https://central.sonatype.com/repository/maven-snapshots/"
246+
247+
notification:
248+
runs-on: ubuntu-latest
249+
needs: [ validate-develop, maven-central-snapshot, github-packages-snapshot, verify-deployments ]
250+
if: always() && github.ref == 'refs/heads/develop'
251+
252+
steps:
253+
- name: Workflow status summary
254+
run: |
255+
VERSION="${{ needs.validate-develop.outputs.snapshot-version }}"
256+
257+
echo "πŸ“Š Develop Branch Snapshot Workflow Summary"
258+
echo "============================================="
259+
echo "πŸ”’ Version: $VERSION"
260+
echo "πŸ“… Triggered: ${{ github.event_name }}"
261+
echo ""
262+
echo "Job Results:"
263+
echo "βœ“ Validation: ${{ needs.validate-develop.result }}"
264+
echo "βœ“ Maven Central: ${{ needs.maven-central-snapshot.result }}"
265+
echo "βœ“ GitHub Packages: ${{ needs.github-packages-snapshot.result }}"
266+
echo "βœ“ Verification: ${{ needs.verify-deployments.result }}"
267+
echo ""
268+
269+
# Check overall success
270+
if [[ "${{ needs.validate-develop.result }}" == "success" &&
271+
"${{ needs.maven-central-snapshot.result }}" == "success" &&
272+
"${{ needs.github-packages-snapshot.result }}" == "success" ]]; then
273+
echo "πŸŽ‰ All snapshot deployments completed successfully!"
274+
echo "πŸ“¦ $VERSION is now available for testing"
275+
else
276+
echo "⚠️ Some deployments may have failed. Check individual job results above."
277+
fi
278+
279+
echo ""
280+
echo "πŸ”— Quick Access:"
281+
echo "- Maven Central: https://central.sonatype.com/repository/maven-snapshots/io/logdash/logdash/$VERSION/"
282+
echo "- GitHub Packages: https://github.com/logdash-io/java-sdk/packages"
283+
echo "- Workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

0 commit comments

Comments
Β (0)