macOS build #371
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: macOS build | |
on: | |
schedule: | |
- cron: '30 7 * * 1,5' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build on macOS | |
runs-on: macos-14 | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12.3' | |
- name: Toolchain Cache | |
id: mac-toolchain | |
uses: actions/cache@v4 | |
with: | |
path: ~/mac-toolchain | |
key: ${{ runner.os }}-${{ runner.arch }}-toolchain | |
- name: Cargo-C Toolchain Cache | |
id: mac-cargo-c-toolchain | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/cargo-capi | |
~/.cargo/bin/cargo-cbuild | |
~/.cargo/bin/cargo-cinstall | |
key: ${{ runner.os }}-${{ runner.arch }}-cargo-c-toolchain | |
- name: Download the Source Code | |
run: | | |
git clone https://github.com/HandBrake/HandBrake.git | |
- name: Setup Environment | |
run: | | |
echo ~/mac-toolchain/bin >> $GITHUB_PATH | |
rustup target add x86_64-apple-darwin | |
- name: Setup Toolchain | |
if: steps.mac-toolchain.outputs.cache-hit != 'true' | |
run: | | |
pip install setuptools | |
HandBrake/scripts/mac-toolchain-build ~/mac-toolchain | |
- name: Setup Cargo-C Toolchain | |
if: steps.mac-cargo-c-toolchain.outputs.cache-hit != 'true' | |
run: | | |
cargo install cargo-c | |
- name: Build HandBrake | |
run: | | |
cd HandBrake | |
./configure | |
cd build | |
make ub && make pkg.create | |
- name: Upload Assets | |
uses: actions/upload-artifact@v4 | |
with: | |
name: HandBrake-macos | |
path: ./HandBrake/build/pkg/*.dmg | |
deploy_nightly: | |
name: Deploy Nightly Build | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Artifacts - Universal Binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: HandBrake-macos | |
path: mac/ | |
# Generate Hashes | |
- name: Generate SHA265 Hashes | |
run: | | |
cd mac | |
sha256sum * > sha256.txt | |
cp sha256.txt ../.github/workflows/ | |
cd .. | |
cd .github/workflows/ | |
sed -e 's/ / | /' -i sha256.txt | |
sed -e 's/^/| /' -i sha256.txt | |
sed -e 's/$/ |/' -i sha256.txt | |
cat sha256.txt >> mac_rel_body.md | |
# Publishing the Release | |
- name: Remove the old Release | |
uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 0 | |
delete_tag_pattern: "mac" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "mac/*.*" | |
name: "Snapshots for macOS" | |
bodyFile: .github/workflows/mac_rel_body.md | |
prerelease: true | |
replacesArtifacts: false | |
allowUpdates: false | |
tag: mac | |
token: ${{ secrets.GITHUB_TOKEN }} |