Skip to content

Commit a887804

Browse files
Add scripts to handle stripped release (#43)
* Add scripts to handle stripped release * Tweak naming * Potential fix for code scanning alert no. 4: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent c6a8b95 commit a887804

14 files changed

Lines changed: 263 additions & 5 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Fetches webrtc.android*.tar.gz artifacts from a workflow run in webrtc-sdk/webrtc-build.
2+
# Required: secret WEBRTC_ARTIFACT_FETCH_TOKEN (PAT with repo + actions:read on the source repo).
3+
# Run ID: from the Actions run URL in webrtc-build, e.g. .../actions/runs/123456789
4+
name: Fetch WebRTC artifacts and create release
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
run_id:
10+
description: 'Workflow run ID from webrtc-sdk/webrtc-build (from the Actions run URL)'
11+
required: true
12+
type: string
13+
repo:
14+
description: 'Source repo (owner/repo) that produced the artifacts'
15+
required: false
16+
default: 'webrtc-sdk/webrtc-build'
17+
type: string
18+
release_tag:
19+
description: 'Tag name for the draft release (e.g. v1.0.0 or webrtc-12345)'
20+
required: true
21+
type: string
22+
23+
jobs:
24+
fetch-artifacts:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
- artifact_name: webrtc.android.tar.gz
33+
output_name: libwebrtc.aar
34+
path_suffix: webrtc-android
35+
- artifact_name: webrtc.android_prefixed.tar.gz
36+
output_name: libwebrtc_prefixed.aar
37+
path_suffix: webrtc-android-prefixed
38+
- artifact_name: webrtc.android_prefixed_stripped.tar.gz
39+
output_name: libwebrtc_prefixed_stripped.aar
40+
path_suffix: webrtc-android-prefixed-stripped
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Download artifact
46+
uses: dawidd6/action-download-artifact@v16
47+
with:
48+
run_id: ${{ inputs.run_id }}
49+
repo: ${{ inputs.repo }}
50+
name: ${{ matrix.artifact_name }}
51+
path: ./artifacts/${{ matrix.path_suffix }}
52+
github_token: ${{ secrets.WEBRTC_ARTIFACT_FETCH_TOKEN }}
53+
54+
- name: Untar and extract libwebrtc.aar
55+
run: |
56+
mkdir -p ./aar-output
57+
TAR=$(find ./artifacts/${{ matrix.path_suffix }} -name '${{ matrix.artifact_name }}' -type f | head -1)
58+
tar -xzf "$TAR" -C ./artifacts/${{ matrix.path_suffix }}
59+
cp "$(find ./artifacts/${{ matrix.path_suffix }} -name 'libwebrtc.aar' -type f | head -1)" ./aar-output/${{ matrix.output_name }}
60+
61+
- name: Upload AAR
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: ${{ matrix.output_name }}
65+
path: ./aar-output/${{ matrix.output_name }}
66+
67+
release:
68+
runs-on: ubuntu-latest
69+
permissions:
70+
contents: write
71+
needs: fetch-artifacts
72+
steps:
73+
- name: Download all AARs
74+
uses: actions/download-artifact@v4
75+
with:
76+
path: ./aar-output
77+
merge-multiple: true
78+
79+
- name: Create draft release and upload AARs
80+
uses: softprops/action-gh-release@v2
81+
with:
82+
tag_name: ${{ github.event.inputs.release_tag }}
83+
draft: true
84+
files: |
85+
aar-output/*.aar
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@ build/
22
.gradle/
33
.DS_Store
44
*.asc
5-
local.properties
5+
local.properties
6+
.idea/
7+
.vscode/
8+
9+
# Generated files when testing locally
10+
**/libs/classes.jar
11+
**/jniLibs/*
12+
libwebrtc*.aar

.idea/gradle.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,12 @@ avoiding any collisions with other WebRTC libraries:
2121
dependencies {
2222
implementation 'io.github.webrtc-sdk:android-prefixed:137.7151.05'
2323
}
24+
```
25+
26+
A stripped variant of the prefixed library (smaller size) is also available:
27+
28+
```gradle
29+
dependencies {
30+
implementation 'io.github.webrtc-sdk:android-prefixed-stripped:137.7151.05'
31+
}
2432
```

RELEASING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
1. Update README.md with new version numbers.
55
1. Update CHANGES.md with change log.
66
1. Tag with new version number (ensuring that the tag is prefixed with a `v`).
7-
1. Create a new release on Github.
8-
1. Add the `libwebrtc.aar` and `libwebrtc_prefixed.aar` files to the release.
7+
1. Create a new release on Github (the fetch job can handle this and the following step automatically)
8+
1. Add the `libwebrtc.aar`, `libwebrtc_prefixed.aar`, and `libwebrtc_prefixed_stripped.aar` files to the release.
99
1. Rerun the associated release github action.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
plugins {
2+
id 'signing'
3+
id 'com.android.library'
4+
id 'com.kezong.fat-aar'
5+
id 'maven-publish'
6+
}
7+
group = 'com.github.webrtc-sdk'
8+
9+
android {
10+
namespace 'com.github.webrtc-sdk.android-prefixed-stripped'
11+
compileSdk 33
12+
13+
defaultConfig {
14+
minSdk 21
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
}
21+
}
22+
compileOptions {
23+
sourceCompatibility JavaVersion.VERSION_1_7
24+
targetCompatibility JavaVersion.VERSION_1_7
25+
}
26+
afterEvaluate {
27+
generateReleaseBuildConfig.enabled = false
28+
generateDebugBuildConfig.enabled = false
29+
generateReleaseResValues.enabled = false
30+
generateDebugResValues.enabled = false
31+
}
32+
}
33+
34+
dependencies {
35+
compileOnly project(path: ':android-prefixed-stripped:shadow', configuration: 'shadow')
36+
embed project(path: ':android-prefixed-stripped:shadow', configuration: 'shadow')
37+
}
38+
39+
def POM_ARTIFACT_ID = "android-prefixed-stripped"
40+
41+
def configurePom(pom) {
42+
pom.name = POM_NAME
43+
pom.packaging = POM_PACKAGING
44+
pom.description = POM_DESCRIPTION
45+
pom.url = POM_URL
46+
47+
pom.scm {
48+
url = POM_SCM_URL
49+
connection = POM_SCM_CONNECTION
50+
developerConnection = POM_SCM_DEV_CONNECTION
51+
}
52+
53+
pom.licenses {
54+
license {
55+
name = POM_LICENCE_NAME
56+
url = POM_LICENCE_URL
57+
distribution = POM_LICENCE_DIST
58+
}
59+
}
60+
61+
pom.developers {
62+
developer {
63+
id = POM_DEVELOPER_ID
64+
name = POM_DEVELOPER_NAME
65+
}
66+
}
67+
}
68+
69+
afterEvaluate {
70+
71+
publishing {
72+
publications {
73+
androidPrefixedStripped(MavenPublication) {
74+
// Applies the component for the release build variant.
75+
from components.release
76+
77+
groupId = GROUP
78+
artifactId = POM_ARTIFACT_ID
79+
version = VERSION_NAME
80+
artifact("deploy/sources.jar") {
81+
classifier 'sources'
82+
}
83+
artifact("deploy/javadoc.jar") {
84+
classifier 'javadoc'
85+
}
86+
configurePom(pom)
87+
}
88+
}
89+
90+
signing {
91+
publishing.publications.all { publication ->
92+
sign publication
93+
}
94+
}
95+
}
96+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Javadoc and sources are not available, but are required for deployment on Sonatype. These jars are used to bypass those checks.
206 Bytes
Binary file not shown.
206 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)