-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (77 loc) · 2.83 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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