fix(ci): Pull SDK from nightly builds. #6
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: Build | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- created | |
concurrency: | |
group: "build" | |
cancel-in-progress: true | |
jobs: | |
cleanup: | |
name: Cleanup | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
contents: read | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Cleanup | |
run: | | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
BRANCH=${{ github.ref }} | |
echo "Fetching list of cache key" | |
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | |
## Setting this to not fail the workflow while deleting cache keys. | |
set +e | |
echo "Deleting caches..." | |
for cacheKey in $cacheKeysForPR | |
do | |
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | |
done | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
needs: [cleanup] | |
uses: AmplitudeAudio/sdk/.github/workflows/cmake.yml@develop | |
with: | |
project-path: . | |
project-slug: plugin_flac | |
pull-sdk: true | |
sdk-version: nightly | |
need-flatc: false | |
name: Flac Codec | |
release: | |
needs: [build] | |
runs-on: ${{ matrix.config.os }} | |
name: "[${{ matrix.build_type }}] ${{ matrix.config.name }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: ["release", "debug"] | |
config: | |
- name: "Windows Latest MSVC" | |
os: windows-latest | |
archiver: "7z a" | |
target_triplet: x64-windows | |
- name: "Windows Latest MinGW" | |
os: windows-latest | |
archiver: "7z a" | |
target_triplet: x64-mingw-static | |
- name: "Ubuntu Latest GCC" | |
os: ubuntu-latest | |
archiver: "7z a" | |
target_triplet: x64-linux | |
- name: "macOS x64 Latest Clang" | |
os: macos-13 | |
archiver: "7za a" | |
target_triplet: x64-osx | |
- name: "macOS arm64 Latest Clang" | |
os: macos-14 | |
archiver: "7za a" | |
target_triplet: arm64-osx | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Restore SDK Cache | |
uses: actions/cache/restore@v4 | |
with: | |
enableCrossOsArchive: true | |
path: sdk | |
key: ${{ matrix.build_type }}-plugin_flac-${{ matrix.config.target_triplet }}-${{ hashFiles('**/sdk') }} | |
restore-keys: | | |
${{ matrix.build_type }}-plugin_flac-${{ matrix.config.target_triplet }}- | |
- name: Pack | |
shell: bash | |
run: ${{ matrix.config.archiver }} ./${{ matrix.build_type }}_plugin_flac_${{ matrix.config.target_triplet }}.7z LICENSE README.md sdk | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
LICENSE | |
README.md | |
sdk/ | |
name: ${{ matrix.build_type }}_plugin_flac_${{ matrix.config.target_triplet }} | |
- name: Upload release asset | |
if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'created') | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./${{ matrix.build_type }}_plugin_flac_${{ matrix.config.target_triplet }}.7z | |
asset_name: ${{ matrix.build_type }}_plugin_flac_${{ matrix.config.target_triplet }}.7z | |
asset_content_type: application/x-7z-compressed |