Don't modify filenames, it complicates matters downstream. #51
Workflow file for this run
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 skshaderc | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch to build' | |
type: string | |
required: true | |
versionName: | |
description: 'Version name' | |
type: string | |
required: true | |
workflow_call: | |
inputs: | |
branch: | |
description: 'Branch to build' | |
type: string | |
required: true | |
versionName: | |
description: 'Version name' | |
type: string | |
required: true | |
push: | |
tags: | |
- v** | |
permissions: | |
contents: write | |
actions: write | |
jobs: | |
########################################### | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
versionName: ${{ steps.set_version.outputs.versionName }} | |
steps: | |
- name: Set Version | |
id: set_version | |
run: | | |
# use the input version name only if it is not empty | |
if [ -z "${{ github.event.inputs.versionName }}" ]; then | |
echo "versionName: ${{ github.ref_name }}" | |
echo "versionName=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
else | |
echo "versionName: ${{ github.event.inputs.versionName }}" | |
echo "versionName=${{ github.event.inputs.versionName }}" >> "$GITHUB_OUTPUT" | |
fi | |
build-windows: | |
runs-on: windows-latest | |
needs: version | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.branch }} | |
- uses: lukka/[email protected] | |
- name: Build Native Win32 x64 | |
run: | | |
cmake --preset skshaderc_Win32_x64_Release | |
cmake --build --preset skshaderc_Win32_x64_Release | |
mkdir bin/distribute/tools/win32_x64 | |
copy bin/intermediate/Win32_x64/Release/skshaderc_exe.exe bin/distribute/tools/win32_x64/skshaderc.exe | |
mkdir bin/distribute/src | |
copy sk_gpu.h bin/distribute/src/sk_gpu.h | |
copy skshaderc/CMakeLists.distribute.txt bin/distribute/CMakeLists.txt | |
- name: Build Native Win32 Arm64 | |
run: | | |
cmake --preset skshaderc_Win32_Arm64_Release | |
cmake --build --preset skshaderc_Win32_Arm64_Release | |
mkdir bin/distribute/tools/win32_arm64 | |
copy bin/intermediate/Win32_Arm64/Release/skshaderc_exe.exe bin/distribute/tools/win32_arm64/skshaderc.exe | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sk_gpu.${{ needs.version.outputs.versionName }}.windows | |
path: bin/distribute/ | |
########################################### | |
build-linux: | |
runs-on: ubuntu-20.04 | |
needs: version | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.branch }} | |
- uses: lukka/[email protected] | |
- name: Install Prerequisites | |
run: | | |
sudo apt-get update | |
sudo apt-get install ninja-build | |
- name: Build Native Linux x64 | |
run: | | |
cmake --preset skshaderc_Linux_x64_Release | |
cmake --build --preset skshaderc_Linux_x64_Release | |
mkdir -p bin/distribute/tools/linux_x64 | |
cp bin/intermediate/Linux_x64_Release/skshaderc_exe bin/distribute/tools/linux_x64/skshaderc | |
chmod +x bin/distribute/tools/linux_x64/skshaderc | |
- name: Install Arm64 Prerequisites | |
run: | | |
sudo cp ./cmake/arm-cross-compile-sources-focal.list /etc/apt/sources.list.d/ | |
sudo sed -i "s/deb mirror/deb [arch=amd64] mirror/g" /etc/apt/sources.list | |
sudo dpkg --add-architecture arm64 | |
sudo apt-get update | |
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu lld:arm64 | |
- name: Build Linux Arm64 | |
run: | | |
cmake --preset skshaderc_Linux_Arm64_Release | |
cmake --build --preset skshaderc_Linux_Arm64_Release | |
mkdir -p bin/distribute/tools/linux_arm64 | |
cp bin/intermediate/Linux_ARM64_Release/skshaderc_exe bin/distribute/tools/linux_arm64/skshaderc | |
chmod +x bin/distribute/tools/linux_arm64/skshaderc | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sk_gpu.${{ needs.version.outputs.versionName }}.linux | |
path: bin/distribute/ | |
########################################### | |
build-mac: | |
runs-on: macos-latest | |
needs: version | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.branch }} | |
- uses: lukka/[email protected] | |
- name: Build Native Mac | |
run: | | |
cmake --preset skshaderc_Mac_Release | |
cmake --build --preset skshaderc_Mac_Release | |
- name: Strip binary | |
run: | | |
ls -l bin/intermediate/Mac_Release/skshaderc_exe | |
strip -S bin/intermediate/Mac_Release/skshaderc_exe | |
ls -l bin/intermediate/Mac_Release/skshaderc_exe | |
- name: Copy binary | |
run: | | |
mkdir -p bin/distribute/tools/mac | |
cp bin/intermediate/Mac_Release/skshaderc_exe bin/distribute/tools/mac/skshaderc | |
chmod +x bin/distribute/tools/mac/skshaderc | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sk_gpu.${{ needs.version.outputs.versionName }}.macos | |
path: bin/distribute/ | |
########################################### | |
make-release: | |
runs-on: ubuntu-latest | |
needs: [version, build-windows, build-linux, build-mac] | |
steps: | |
- name: Merge Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: release/ | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sk_gpu.${{ needs.version.outputs.versionName }} | |
path: release/ | |
- name: Make draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
run: | | |
cd release | |
zip -r sk_gpu.${{ needs.version.outputs.versionName }}.zip . | |
gh release create "$tag" sk_gpu.${{ needs.version.outputs.versionName }}.zip \ | |
--prerelease \ | |
--verify-tag \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${{ github.ref_name }}" |