Upgrade actions/download-artifact
from 3 to 4 version (#69)
#372
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: ["main"] | |
tags: ["*"] | |
pull_request: | |
branches: ["main"] | |
paths-ignore: ["**.md"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
############ | |
# Building # | |
############ | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: android | |
- os: ios | |
- os: linux | |
arch: arm64 | |
- os: linux | |
arch: x64 | |
- os: macos | |
arch: arm64 | |
- os: macos | |
arch: x64 | |
- os: windows | |
arch: x64 | |
runs-on: ${{ (contains('ios macos', matrix.os) && 'macos-11') | |
|| (contains('windows', matrix.os) && 'windows-2019') | |
|| 'ubuntu-latest' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: ./disk_cleanup.sh | |
if: ${{ contains('android linux', matrix.os) }} | |
- run: powershell .\disk_cleanup.bat | |
if: ${{ contains('windows', matrix.os) }} | |
- run: pip install setuptools | |
if: ${{ contains('ios macos', matrix.os) }} | |
- run: make -C docker ${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }} | |
if: ${{ contains('android linux', matrix.os) }} | |
- run: make -C build USE_CCACHE=0 ${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }} | |
if: ${{ contains('ios macos', matrix.os) }} | |
- run: powershell .\build.windows.bat | |
if: ${{ contains('windows', matrix.os) }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }} | |
path: package/libwebrtc-${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}.${{ (matrix.os == 'ios' && 'zip') || 'tar.gz' }} | |
if-no-files-found: error | |
############# | |
# Releasing # | |
############# | |
publish-android: | |
name: publish (Android) | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
needs: ["release-github"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "17" | |
distribution: temurin | |
- name: Parse release version | |
id: release | |
run: echo "version=${GITHUB_REF#refs/tags/}" | |
>> $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-android | |
path: package/ | |
- run: tar -xzvf libwebrtc-android.tar.gz | |
working-directory: package/ | |
- name: Build Maven files | |
run: mvn install:install-file | |
-DgroupId=com.github.instrumentisto | |
-DartifactId=libwebrtc-bin | |
-Dversion=${{ steps.release.outputs.version }} | |
-Dfile=./package/aar/libwebrtc.aar | |
-Dpackaging=aar | |
-DgeneratePom=true | |
-DlocalRepositoryPath=./android/ | |
-DcreateChecksum=true | |
- name: Publish to GitHub Pages | |
run: | | |
set -ex | |
git config --local user.email 'actions+${{ github.run_number }}@github.com' | |
git config --local user.name 'GitHub Actions' | |
git add -v android/ | |
git commit -m 'Release ${{ steps.release.outputs.version }} version of `libwebrtc-android`' | |
git push origin gh-pages | |
publish-cocoapods: | |
name: publish (CocoaPods) | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
needs: ["release-github"] | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: maxim-lobanov/setup-cocoapods@v1 | |
with: | |
version: latest | |
- run: pod spec lint --allow-warnings --verbose | |
- run: pod trunk push --allow-warnings | |
env: | |
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | |
release-github: | |
name: release (GitHub) | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
needs: ["build"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Parse release version | |
id: release | |
run: echo "version=${GITHUB_REF#refs/tags/}" | |
>> $GITHUB_OUTPUT | |
- name: Verify release version matches VERSION file | |
run: | | |
test "${{ steps.release.outputs.version }}" \ | |
== "$(grep 'WEBRTC_VERSION=' VERSION | cut -d '=' -f2 | tr -d '\n')" | |
if: ${{ !contains(steps.release.outputs.version, '-') }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-android | |
path: package/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-ios | |
path: package/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-linux-arm64 | |
path: package/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-linux-x64 | |
path: package/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-macos-arm64 | |
path: package/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-macos-x64 | |
path: package/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-windows-x64 | |
path: package/ | |
- name: Generate SHA256 checksums | |
run: ls -1 | xargs -I {} sh -c "sha256sum {} > {}.sha256sum" | |
working-directory: package/ | |
- name: Show generated SHA256 checksums | |
run: cat *.sha256sum | |
working-directory: package/ | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ steps.release.outputs.version }} | |
files: | | |
package/libwebrtc-*.tar.gz | |
package/libwebrtc-*.tar.gz.sha256sum | |
package/libwebrtc-*.zip | |
package/libwebrtc-*.zip.sha256sum | |
fail_on_unmatched_files: true | |
prerelease: ${{ contains(steps.release.outputs.version, '-') }} |