build_and_release #74
Workflow file for this run
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
# This workflow will create a release and build multiple versions of the webrtc library. | |
name: build_and_release | |
on: | |
workflow_dispatch: | |
inputs: | |
fail_fast: | |
description: "Should stop the workflow as soon as one configuration fails" | |
required: false | |
type: boolean | |
default: true | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Generate Version Output | |
id: generate_version_output | |
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Print Version Information | |
run: echo "Version ${{ steps.generate_version_output.outputs.version }}" | |
shell: bash | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ steps.generate_version_output.outputs.version }} | |
release_name: webrtc-native-build-${{ steps.generate_version_output.outputs.version }} | |
body: | | |
Latest build of webrtc-native-build | |
- This is a prerelease, use at your own risks. | |
draft: true | |
prerelease: true | |
- name: Output Release URL File | |
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt | |
- name: Save Release URL File for publish | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release_url | |
path: release_url.txt | |
build-linux: | |
needs: create-release | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] | |
architecture: [arm64, amd64] | |
build-type: [Release, Debug] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 40000 | |
swap-size-mb: 1024 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
remove-docker-images: 'true' | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release_url | |
- name: Get Upload URL | |
id: get_release_info | |
run: | | |
echo "upload_url=$(cat release_url.txt)" >> $GITHUB_OUTPUT | |
ls -l | |
cat release_url.txt | |
- name: Generate Version Output | |
id: generate_version_output | |
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Print Version Information | |
run: echo "Version ${{ steps.generate_version_output.outputs.version }}" | |
shell: bash | |
- name: Generate Release File Name | |
id: generate_release_file_name | |
run: | | |
echo "release_file_name=webrtc-native-build-${{ matrix.os }}-\ | |
${{ matrix.architecture }}-\ | |
${{ matrix.build-type }}-\ | |
${{ steps.generate_version_output.outputs.version }}" >> $GITHUB_OUTPUT | |
- name: Generate Branch Name | |
id: generate_branch_name | |
run: | | |
echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
- name: Print Release File Name | |
run: echo "Release File Name ${{ steps.generate_release_file_name.outputs.release_file_name }} on branch ${{ steps.generate_branch_name.outputs.branch_name }}" | |
shell: bash | |
- name: Create and run Docker Image | |
working-directory: ./docker/${{ matrix.os }} | |
run: | | |
docker buildx build -t webrtc --build-arg BUILD_TYPE=${{ matrix.build-type }} --build-arg BUILD_ARCHITECTURE=${{ matrix.architecture }} --build-arg BUILD_BRANCH=${{ steps.generate_branch_name.outputs.branch_name }} . | |
docker run --rm --volume $PWD:/data webrtc tar cvzf /data/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz ./ | |
ls -l | |
shell: bash | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
asset_path: ./docker/${{ matrix.os }}/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz | |
asset_name: ${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz | |
asset_content_type: application/x-gzip | |
build-mac: | |
needs: create-release | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-12, macos-13] | |
architecture: [osx64] | |
build-type: [Release, Debug] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release_url | |
- name: Get Upload URL | |
id: get_release_info | |
run: | | |
echo "upload_url=$(cat release_url.txt)" >> $GITHUB_OUTPUT | |
ls -l | |
cat release_url.txt | |
- name: Generate Version Output | |
id: generate_version_output | |
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Print Version Information | |
run: echo "Version ${{ steps.generate_version_output.outputs.version }}" | |
shell: bash | |
- name: Generate Release File Name | |
id: generate_release_file_name | |
run: | | |
echo "release_file_name=webrtc-native-build-${{ matrix.os }}-\ | |
${{ matrix.architecture }}-\ | |
${{ matrix.build-type }}-\ | |
${{ steps.generate_version_output.outputs.version }}" >> $GITHUB_OUTPUT | |
- name: Print Release File Name | |
run: echo "Release File Name ${{ steps.generate_release_file_name.outputs.release_file_name }}" | |
shell: bash | |
- name: Install system dependencies | |
run: | | |
brew install ninja | |
- name: Create build directory | |
working-directory: . | |
run: | | |
mkdir build | |
- name: Run CMake and build webrtc-native-build | |
working-directory: build | |
run: | | |
cmake ../ -DCMAKE_BUILD_TYPE=${{ matrix.build-type}} -DCMAKE_BUILD_ARCHITECTURE=${{ matrix.architecture }} | |
export PATH=$PWD/../3rdParty/depot_tools:$PATH | |
make -j3 | |
make install | |
- name: Create Archive | |
working-directory: dist/${{ matrix.build-type }} | |
run: | | |
tar cvzf ${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz webrtc-native-build-${{ steps.generate_version_output.outputs.version }} | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
asset_path: dist/${{ matrix.build-type }}/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz | |
asset_name: ${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz | |
asset_content_type: application/x-gzip |