|
10 | 10 |
|
11 | 11 | jobs: |
12 | 12 | build: |
13 | | - permissions: |
14 | | - contents: write |
15 | | - runs-on: macos-14 |
16 | | - steps: |
17 | | - - uses: actions/checkout@v4 |
18 | | - |
19 | | - - name: Install dependencies |
20 | | - run: | |
21 | | - brew install autoconf |
22 | | - brew install automake |
23 | | - brew install libtool |
24 | | - python -m pip install meson==1.4.2 |
25 | | - brew install ninja |
26 | | -
|
27 | | - - name: Setup Xcode to support visionOS |
28 | | - run: | |
29 | | - sudo xcode-select -s /Applications/Xcode_15.4.app/Contents/Developer |
30 | | - xcodebuild -showsdks |
31 | | -
|
32 | | -
|
33 | | - - name: Check version to release |
34 | | - uses: jannekem/run-python-script-action@v1 |
35 | | - with: |
36 | | - script: | |
37 | | - import re |
38 | | -
|
39 | | - def normalize_version(version_string): |
40 | | - version_string = re.sub(r'[^.0-9]+|-.+', '', version_string) |
41 | | - parts = re.split(r'\.', version_string) |
42 | | - major = int(parts[0]) |
43 | | - minor = int(parts[1]) if len(parts) > 1 else 0 |
44 | | - patch = int(parts[2]) if len(parts) > 2 else 0 |
45 | | - return f"{major}.{minor}.{patch}" |
46 | | -
|
47 | | - file_path = './Sources/BuildScripts/XCFrameworkBuild/main.swift' |
48 | | - with open(file_path, 'r', encoding='utf-8') as file: |
49 | | - content = file.read() |
50 | | - buildVersion = re.search(r'(case .libass[^"]+?)"(.+?)"', content).group(2) |
51 | | - print(f'build version: {buildVersion}') |
52 | | - releaseVersion = '${{ github.event.inputs.version }}' or normalize_version(buildVersion) |
53 | | - print(f'release version: {releaseVersion}') |
54 | | - set_env('BUILD_VERSION', buildVersion) |
55 | | - set_env('RELEASE_VERSION', releaseVersion) |
56 | | -
|
57 | | - - name: Build |
58 | | - run: | |
59 | | - make build version=${{ env.RELEASE_VERSION }} |
60 | | - |
61 | | - - name: Update Package.swift |
62 | | - run: | |
63 | | - rm -rf ./Package.swift |
64 | | - cp -f ./dist/release/Package.swift ./Package.swift |
65 | | - |
66 | | - - name: Push Package.swift |
67 | | - uses: EndBug/add-and-commit@v9 |
68 | | - with: |
69 | | - default_author: github_actions |
70 | | - add: | |
71 | | - - Package.swift |
72 | | - message: "chore: bump version to ${{ env.BUILD_VERSION }}" |
73 | | - push: "origin HEAD:${{ github.ref_name }}" |
74 | | - |
75 | | - - name: Upload binary to GitHub Release |
76 | | - uses: softprops/action-gh-release@v2 |
77 | | - with: |
78 | | - name: ${{ contains(env.RELEASE_VERSION, '-') && env.RELEASE_VERSION || env.BUILD_VERSION }} |
79 | | - tag_name: ${{ env.RELEASE_VERSION }} |
80 | | - files: | |
81 | | - ./dist/release/*.txt |
82 | | - ./dist/release/*.zip |
83 | | - prerelease: ${{ contains(env.RELEASE_VERSION, '-') }} |
84 | | - generate_release_notes: true |
85 | | - fail_on_unmatched_files: true |
| 13 | + uses: mpvkit/action/.github/workflows/build.yml@main |
| 14 | + secrets: inherit |
| 15 | + with: |
| 16 | + version: '${{ github.event.inputs.version }}' |
| 17 | + library: 'libass' |
| 18 | + try_run: true |
0 commit comments