Skip to content

Commit

Permalink
Create build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonmojo authored May 8, 2024
1 parent 9d846f2 commit 26fc522
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
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

0 comments on commit 26fc522

Please sign in to comment.