Build #1
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: | |
tags: | |
- '3.*.*' | |
paths-ignore: | |
- '.github/workflows/x-*.yml' | |
workflow_dispatch: # manually-triggered runs | |
permissions: | |
# allowed to create releases (ref. https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) | |
contents: write | |
concurrency: | |
# cancel pending runs when a PR gets updated (ref. https://github.com/rust-lang/rust/blob/75fd074338801fba74a8cf7f8c48c5c5be362d08/.github/workflows/ci.yml#L35) | |
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: Build | |
runs-on: macos-14 | |
env: # use tag version, if available, falling back to 2.4.1 (stable) | |
OPENH264_VERSION: "${{ startsWith(github.ref, 'refs/tags/2.') && github.ref_name || '2.4.1' }}" | |
PUBLISH_RELEASE: "${{ startsWith(github.ref, 'refs/tags/2.') && '1' || '0' }}" | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: restore cache | |
id: cache-openh264-src | |
uses: actions/cache/restore@v4 | |
with: | |
key: "openh264-src-${{ env.OPENH264_VERSION }}" | |
path: | | |
build/openh264-${{ env.OPENH264_VERSION }}.tar.gz | |
- name: build | |
run: scripts/build.sh | |
- name: save cache | |
if: "steps.cache-openh264-src.outputs.cache-hit != 'true'" | |
uses: actions/cache/save@v4 | |
with: | |
key: "${{ steps.cache-openh264-src.outputs.cache-primary-key }}" | |
path: | | |
build/openh264-${{ env.OPENH264_VERSION }}.tar.gz | |
- name: publish native libraries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "openh264-${{ env.OPENH264_VERSION }}" | |
retention-days: 5 | |
if-no-files-found: "error" | |
path: | | |
build/openh264-${{ env.OPENH264_VERSION }}/build/iphoneos/** | |
build/openh264-${{ env.OPENH264_VERSION }}/build/iphonesimulator/** | |
build/openh264-${{ env.OPENH264_VERSION }}/build/macosx/** | |
- name: publish xcframework | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "openh264-${{ env.OPENH264_VERSION }}.xcframework" | |
retention-days: 5 | |
if-no-files-found: "error" | |
path: | | |
build/openh264-${{ env.OPENH264_VERSION }}/build/Openh264.xcframework | |
- name: pack release artifacts | |
if: "success() && env.PUBLISH_RELEASE == '1'" | |
run: scripts/release.sh | |
- name: create release | |
if: "success() && env.PUBLISH_RELEASE == '1'" | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: "${{ env.OPENH264_VERSION }}" | |
draft: true | |
prerelease: false | |
generate_release_notes: false | |
fail_on_unmatched_files: true | |
files: | | |
build/openh264-${{ env.OPENH264_VERSION }}/build/openh264.tar.gz | |
build/openh264-${{ env.OPENH264_VERSION }}/build/Openh264.xcframework.tar.gz |