Skip to content

Fetch WebRTC artifacts and create release #3

Fetch WebRTC artifacts and create release

Fetch WebRTC artifacts and create release #3

# Fetches webrtc.android*.tar.gz artifacts from a workflow run in webrtc-sdk/webrtc-build.
# Required: secret WEBRTC_ARTIFACT_FETCH_TOKEN (PAT with repo + actions:read on the source repo).
# Run ID: from the Actions run URL in webrtc-build, e.g. .../actions/runs/123456789
name: Fetch WebRTC artifacts and create release
on:
workflow_dispatch:
inputs:
run_id:
description: 'Workflow run ID from webrtc-sdk/webrtc-build (from the Actions run URL)'
required: true
type: string
repo:
description: 'Source repo (owner/repo) that produced the artifacts'
required: false
default: 'webrtc-sdk/webrtc-build'
type: string
release_tag:
description: 'Tag name for the draft release (e.g. v1.0.0 or webrtc-12345)'
required: true
type: string
jobs:
fetch-artifacts:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- artifact_name: webrtc.android.tar.gz
output_name: libwebrtc.aar
path_suffix: webrtc-android
- artifact_name: webrtc.android_prefixed.tar.gz
output_name: libwebrtc_prefixed.aar
path_suffix: webrtc-android-prefixed
- artifact_name: webrtc.android_prefixed_stripped.tar.gz
output_name: libwebrtc_prefixed_stripped.aar
path_suffix: webrtc-android-prefixed-stripped
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: dawidd6/action-download-artifact@v16
with:
run_id: ${{ inputs.run_id }}
repo: ${{ inputs.repo }}
name: ${{ matrix.artifact_name }}
path: ./artifacts/${{ matrix.path_suffix }}
github_token: ${{ secrets.WEBRTC_ARTIFACT_FETCH_TOKEN }}
- name: Untar and extract libwebrtc.aar
run: |
mkdir -p ./aar-output
ARTIFACT_DIR="./artifacts/${{ matrix.path_suffix }}"
# Downloaded artifact is named webrtc.tar.gz (not artifact_name)
TAR=$(find "$ARTIFACT_DIR" -name 'webrtc.tar.gz' -type f | head -1)
if [[ -z "$TAR" ]]; then
echo "No webrtc.tar.gz found under $ARTIFACT_DIR. Contents:"
find "$ARTIFACT_DIR" -type f -o -type d | head -50
exit 1
fi
tar -xzf "$TAR" -C "$ARTIFACT_DIR"
AAR=$(find "$ARTIFACT_DIR" -name 'libwebrtc.aar' -type f | head -1)
if [[ -z "$AAR" ]]; then
echo "No libwebrtc.aar found after extract. Contents:"
find "$ARTIFACT_DIR" -type f | head -50
exit 1
fi
cp "$AAR" ./aar-output/${{ matrix.output_name }}
- name: Upload AAR
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output_name }}
path: ./aar-output/${{ matrix.output_name }}
release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: fetch-artifacts
steps:
- name: Download all AARs
uses: actions/download-artifact@v4
with:
path: ./aar-output
merge-multiple: true
- name: Create draft release and upload AARs
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.release_tag }}
draft: true
files: |
aar-output/*.aar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}