Skip to content

Commit 1b63c53

Browse files
committed
feat: update sourcemap upload endpoint, add github workflows
1 parent 0f4019f commit 1b63c53

9 files changed

Lines changed: 285 additions & 84 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Publish Plugin
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # 正式版发布: v1.0.0, v1.1.0, etc.
7+
branches:
8+
- publish # Snapshot 发布
9+
10+
jobs:
11+
publish:
12+
name: Publish to Maven Central
13+
runs-on: ubuntu-latest
14+
15+
# 设置权限
16+
permissions:
17+
contents: write
18+
packages: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Set up JDK 17
27+
uses: actions/setup-java@v4
28+
with:
29+
java-version: '17'
30+
distribution: 'temurin'
31+
cache: 'gradle'
32+
33+
- name: Grant execute permission for gradlew
34+
run: chmod +x gradlew
35+
36+
- name: Determine version type
37+
id: version
38+
run: |
39+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
40+
echo "type=release" >> $GITHUB_OUTPUT
41+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
42+
else
43+
echo "type=snapshot" >> $GITHUB_OUTPUT
44+
echo "tag=snapshot" >> $GITHUB_OUTPUT
45+
fi
46+
47+
- name: Run all tests
48+
run: ./gradlew :dd-sdk-android-gradle-plugin:allTests --stacktrace --no-daemon
49+
50+
- name: Configure GPG
51+
run: |
52+
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --import --batch --yes
53+
echo "allow-loopback-pinentry" > ~/.gnupg/gpg-agent.conf
54+
gpg-connect-agent reloadagent /bye
55+
env:
56+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
57+
58+
- name: Create gradle.properties
59+
run: |
60+
mkdir -p ~/.gradle
61+
echo "mavenCentralUsername=${{ secrets.MAVEN_CENTRAL_USERNAME }}" >> ~/.gradle/gradle.properties
62+
echo "mavenCentralPassword=${{ secrets.MAVEN_CENTRAL_PASSWORD }}" >> ~/.gradle/gradle.properties
63+
echo "signing.gnupg.executable=gpg" >> ~/.gradle/gradle.properties
64+
echo "signing.gnupg.passphrase=${{ secrets.GPG_PASSPHRASE }}" >> ~/.gradle/gradle.properties
65+
66+
- name: Publish to Maven Central
67+
run: |
68+
./gradlew :dd-sdk-android-gradle-plugin:publishPluginMavenPublicationToMavenCentralRepository \
69+
--no-daemon --stacktrace
70+
env:
71+
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
72+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
73+
74+
# 仅在 Tag 发布时发布到 Gradle Plugin Portal
75+
- name: Publish to Gradle Plugin Portal
76+
if: startsWith(github.ref, 'refs/tags/')
77+
run: |
78+
echo "gradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }}" >> ~/.gradle/gradle.properties
79+
echo "gradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}" >> ~/.gradle/gradle.properties
80+
./gradlew :dd-sdk-android-gradle-plugin:publishPlugins --no-daemon --stacktrace
81+
env:
82+
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
83+
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
84+
85+
# 创建 GitHub Release(仅正式版)
86+
- name: Create GitHub Release
87+
if: startsWith(github.ref, 'refs/tags/')
88+
uses: softprops/action-gh-release@v1
89+
with:
90+
generate_release_notes: true
91+
draft: false
92+
prerelease: false
93+
files: |
94+
dd-sdk-android-gradle-plugin/build/libs/*.jar
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
98+
- name: Publish summary
99+
run: |
100+
echo "## 🎉 发布完成" >> $GITHUB_STEP_SUMMARY
101+
echo "" >> $GITHUB_STEP_SUMMARY
102+
echo "**版本类型**: ${{ steps.version.outputs.type }}" >> $GITHUB_STEP_SUMMARY
103+
echo "**版本号**: ${{ steps.version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
if [[ "${{ steps.version.outputs.type }}" == "release" ]]; then
106+
echo "✅ 已发布到 Maven Central" >> $GITHUB_STEP_SUMMARY
107+
echo "✅ 已发布到 Gradle Plugin Portal" >> $GITHUB_STEP_SUMMARY
108+
echo "✅ 已创建 GitHub Release" >> $GITHUB_STEP_SUMMARY
109+
else
110+
echo "✅ Snapshot 已发布到 Maven Central" >> $GITHUB_STEP_SUMMARY
111+
fi
112+

.github/workflows/test.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches: [ main, develop, publish, feat/*, feature/* ]
6+
push:
7+
branches: [ main, develop, publish, feat/*, feature/* ]
8+
9+
jobs:
10+
test:
11+
name: Run Tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
cache: 'gradle'
26+
27+
- name: Grant execute permission for gradlew
28+
run: chmod +x gradlew
29+
30+
- name: Run all tests
31+
run: ./gradlew :dd-sdk-android-gradle-plugin:allTests --stacktrace --no-daemon
32+
33+
- name: Generate test report
34+
if: always()
35+
run: |
36+
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
37+
echo "✅ All tests completed" >> $GITHUB_STEP_SUMMARY
38+
39+
- name: Upload test results
40+
if: always()
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: test-results
44+
path: |
45+
dd-sdk-android-gradle-plugin/build/test-results/
46+
dd-sdk-android-gradle-plugin/build/reports/
47+
48+
- name: Check code coverage
49+
run: ./gradlew :dd-sdk-android-gradle-plugin:jacocoTestCoverageVerification --stacktrace --no-daemon
50+
51+
- name: Upload coverage to Codecov
52+
if: github.event_name == 'push'
53+
uses: codecov/codecov-action@v4
54+
with:
55+
files: dd-sdk-android-gradle-plugin/build/reports/jacoco/test/jacocoTestReport.xml
56+
flags: unittests
57+
name: codecov-umbrella
58+
fail_ci_if_error: false
59+

CHANGELOG.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
1-
# 1.21.0 / 2025-10-02
1+
# 1.0.0 / 2025-12-04 (Flashcat Release)
2+
3+
**First Flashcat Release**
4+
5+
This is the first official release forked from Datadog dd-sdk-android-gradle-plugin v1.21.0 and adapted for the Flashcat platform.
6+
7+
### New Features
8+
* [FEATURE] Support uploading mapping files to Flashcat platform
9+
* [FEATURE] Support uploading NDK symbol files to Flashcat platform
10+
* [FEATURE] Support Flashcat CN and STAGING sites
11+
* [FEATURE] Support `flashcat-ci.json` configuration file
12+
* [FEATURE] Support `FC_API_KEY` and `FLASHCAT_API_KEY` environment variables
13+
14+
### Breaking Changes
15+
* [CHANGE] Extension configuration changed from `datadog {}` to `flashcat {}`
16+
* [CHANGE] Plugin ID changed from `com.datadoghq.dd-sdk-android-gradle-plugin` to `com.flashcat.android-gradle-plugin`
17+
* [CHANGE] Maven coordinates changed from `com.datadoghq` to `cloud.flashcat`
18+
* [CHANGE] Site enum changed from `DatadogSite` to `FlashcatSite`
19+
20+
### Configuration Changes
21+
* CI configuration file keeps `datadog-ci.json` name but uses `flashcatSite` field
22+
* Environment variable priority: `FC_API_KEY` > `FLASHCAT_API_KEY` > `DD_API_KEY` > `DATADOG_API_KEY`
23+
* Site configuration: `CN` (browser.flashcat.cloud) and `STAGING` (jira.flashcat.cloud)
24+
25+
### Links
26+
* GitHub: https://github.com/flashcatcloud/fc-sdk-android-gradle-plugin
27+
* Documentation: https://docs.flashcat.cloud/zh/flashduty/rum/introduction
28+
* Website: https://flashcat.cloud/
29+
30+
### License
31+
* Licensed under Apache License 2.0
32+
* Forked from Datadog dd-sdk-android-gradle-plugin
33+
* Original work copyright: © 2019-2024 Datadog, Inc.
34+
* Modifications copyright: © 2025 Flashcat, Inc.
35+
36+
---
37+
38+
# 1.21.0 / 2025-10-02 (Datadog Original)
239

340
* [IMPROVEMENT] Unbox default type to fix Kotlin 2.2.20 breaking change. See [#440](https://github.com/DataDog/dd-sdk-android-gradle-plugin/pull/449)
441
* [BUGFIX] Fix Kotlin Compiler Plugin wrong jar path for Windows. See [#448](https://github.com/DataDog/dd-sdk-android-gradle-plugin/pull/448)

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ Add the following line to your `build.gradle` file.
2424

2525
```groovy
2626
plugins {
27-
id("com.datadoghq.dd-sdk-android-gradle-plugin") version "x.y.z"
27+
id("com.flashcat.android-gradle-plugin") version "1.0.0"
28+
}
29+
```
30+
31+
或在 Kotlin DSL 中:
32+
33+
```kotlin
34+
plugins {
35+
id("com.flashcat.android-gradle-plugin") version "1.0.0"
2836
}
2937
```
3038

buildSrc/src/main/kotlin/com/datadog/gradle/config/MavenConfig.kt

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,47 @@ import org.gradle.plugins.signing.SigningExtension
1717

1818
object MavenConfig {
1919

20-
val VERSION = Version(1, 22, 0, Version.Type.Snapshot)
21-
const val GROUP_ID = "com.datadoghq"
20+
val VERSION = determineVersion()
21+
const val GROUP_ID = "cloud.flashcat"
2222
const val PUBLICATION = "pluginMaven"
23+
24+
/**
25+
* Determine version based on Git ref type and branch
26+
* - Tag (v*) → Release version (e.g., 1.0.0)
27+
* - publish branch → Snapshot version (e.g., 1.1.0-SNAPSHOT)
28+
* - Other → Local development version
29+
*/
30+
private fun determineVersion(): Version {
31+
val refType = System.getenv("GITHUB_REF_TYPE")
32+
val refName = System.getenv("GITHUB_REF_NAME")
33+
34+
return when {
35+
// Tag release: v1.0.0 → 1.0.0
36+
refType == "tag" && refName?.startsWith("v") == true -> {
37+
parseVersionFromTag(refName)
38+
}
39+
// publish branch → Snapshot
40+
refName == "publish" -> {
41+
Version(1, 1, 0, Version.Type.Snapshot)
42+
}
43+
// Local development or other branches
44+
else -> {
45+
Version(1, 0, 0, Version.Type.Release)
46+
}
47+
}
48+
}
49+
50+
private fun parseVersionFromTag(tag: String): Version {
51+
val versionString = tag.removePrefix("v")
52+
val parts = versionString.split(".")
53+
54+
return Version(
55+
major = parts.getOrNull(0)?.toIntOrNull() ?: 1,
56+
minor = parts.getOrNull(1)?.toIntOrNull() ?: 0,
57+
hotfix = parts.getOrNull(2)?.toIntOrNull() ?: 0,
58+
type = Version.Type.Release
59+
)
60+
}
2361
}
2462

2563
fun Project.publishingConfig(projectDescription: String) {
@@ -64,7 +102,7 @@ fun Project.publishingConfig(projectDescription: String) {
64102
pom {
65103
name.set(projectName)
66104
description.set(projectDescription)
67-
url.set("https://github.com/DataDog/dd-sdk-android-gradle-plugin/")
105+
url.set("https://github.com/flashcatcloud/fc-sdk-android-gradle-plugin/")
68106

69107
licenses {
70108
license {
@@ -73,25 +111,25 @@ fun Project.publishingConfig(projectDescription: String) {
73111
}
74112
}
75113
organization {
76-
name.set("Datadog")
77-
url.set("https://www.datadoghq.com/")
114+
name.set("Flashcat")
115+
url.set("https://flashcat.cloud/")
78116
}
79117
developers {
80118
developer {
81-
name.set("Datadog")
82-
email.set("info@datadoghq.com")
83-
organization.set("Datadog")
84-
organizationUrl.set("https://www.datadoghq.com/")
119+
name.set("Flashcat")
120+
email.set("support@flashcat.cloud")
121+
organization.set("Flashcat")
122+
organizationUrl.set("https://flashcat.cloud/")
85123
}
86124
}
87125

88126
scm {
89-
url.set("https://github.com/DataDog/dd-sdk-android-gradle-plugin/")
127+
url.set("https://github.com/flashcatcloud/fc-sdk-android-gradle-plugin/")
90128
connection.set(
91-
"scm:git:git@github.com:Datadog/dd-sdk-android-gradle-plugin.git"
129+
"scm:git:git@github.com:flashcatcloud/fc-sdk-android-gradle-plugin.git"
92130
)
93131
developerConnection.set(
94-
"scm:git:git@github.com:Datadog/dd-sdk-android-gradle-plugin.git"
132+
"scm:git:git@github.com:flashcatcloud/fc-sdk-android-gradle-plugin.git"
95133
)
96134
}
97135
}

0 commit comments

Comments
 (0)