|
| 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 }} |
0 commit comments