GitHub Checkout action does not support external repos #27
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: Update Opus | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/opus.yml' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build Opus for ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Linux x64", | |
os: ubuntu-latest, | |
install-deps: "sudo apt-get update && sudo apt-get -y install autoconf automake libtool git gcc cmake make", | |
args: "", | |
find-file: "libopus.so.*.*.*", | |
file: "libopus.so" | |
} | |
- { | |
name: "MacOS x64", | |
os: macos-latest, | |
install-deps: "brew install autoconf automake libtool git gcc cmake make && export PATH=\"/usr/local/opt/make/libexec/gnubin:$PATH\"", | |
args: "", | |
find-file: "libopus.*.*.*.dylib", | |
file: "libopus.dylib" | |
} | |
- { | |
name: "Windows x64", | |
os: windows-latest, | |
install-deps: "choco install git cmake make", | |
args: "-G \"Visual Studio 17 2022\" -A x64", | |
find-file: "opus.dll", | |
file: "opus.dll" | |
} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up MSBuild | |
if: matrix.config.os == 'windows-latest' | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
msbuild-architecture: x64 | |
- name: Install dependencies | |
run: ${{ matrix.config.install-deps }} | |
- name: Build on ${{ matrix.config.name }} | |
run: | | |
git clone https://gitlab.xiph.org/xiph/opus.git libs/opus | |
cd libs/opus | |
echo "OPUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV | |
git checkout "$OPUS_VERSION" | |
cmake -S . -B build ${{ matrix.config.args }} -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev | |
cmake --build build --config Release | |
rm "${{ github.workspace }}/libs/libopus/${{ matrix.config.find-file }}" | |
mv "build/${{ matrix.config.find-file }}" "${{ github.workspace }}/libs/libopus/${{ matrix.config.file }}" | |
- name: "Update ${{ matrix.config.file }}" | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "libs/libopus/" | |
default_author: github_actions | |
message: Update ${{ matrix.config.file }} to ${{ env.OPUS_VERSION }} | |
pull: '--rebase --autostash' | |
push: true |