Release pipeline #25
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: Release pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: 'Release version' | |
required: true | |
default: '0.2.0' | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE_DEBUG: Debug | |
BUILD_TYPE_RELEASE: Release | |
jobs: | |
windows-build: | |
runs-on: windows-latest | |
name: Build on Windows | |
# Run both builds in parallel and don't cancel if one fails | |
strategy: | |
matrix: | |
build-type: [Release] | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Vcpkg | |
uses: friendlyanon/setup-vcpkg@v1 | |
# Committish: The commit sha of the vcpkg repo, same as in vcpkg.json | |
with: | |
committish: 821100d967e1737d96414a308e3f7cbe0d1abf18 | |
- name: Delete MSVC tool version | |
shell: pwsh | |
# Add additional scripting steps here | |
run: | | |
cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build' | |
Get-ChildItem -Recurse * | |
Remove-Item * -Include 'Microsoft.VCToolsVersion.v143.default.props','Microsoft.VCToolsVersion.v143.default.txt' -Force | Out-Null | |
Get-ChildItem -Recurse * | |
- name: Setup Microsoft Visual C++ CLI | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Setup Ninja | |
uses: ashutoshvarma/setup-ninja@master | |
with: | |
# ninja version to download. Default: 1.10.0 | |
version: 1.10.0 | |
# This doesn't work when the Visual Studio C++ CLI was set up first (maybe needs a setup with 2019 version) | |
- name: Install Vulkan SDK | |
uses: humbletim/[email protected] | |
with: | |
version: 1.3.261.1 | |
cache: true | |
- name: Run scripts | |
shell: pwsh | |
# Add additional scripting steps here | |
run: | | |
cd ${{ github.workspace }} | |
${{ github.workspace }}/vcpkg/vcpkg install --clean-after-build --triplet=x64-windows | |
Remove-Item –path vcpkg_installed –recurse | |
- name: Build ${{ matrix.build-type }} configuration with CMake | |
uses: ashutoshvarma/action-cmake-build@master | |
with: | |
build-dir: ${{ github.workspace }}/build/${{ matrix.build-type }} | |
source-dir: ${{ github.workspace }} | |
cc: "cl" | |
cxx: "cl" | |
configure-options: -G Ninja -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake' | |
-DASSIMP_BUILD_TESTS=OFF -DASSIMP_BUILD_ASSIMP_TOOLS=OFF -DATLAS_DEMO=ON -DATLAS_TESTS=OFF -DATLAS_EDITOR=ON | |
parallel: 16 | |
build-type: ${{ matrix.build-type }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Atlas Engine Windows | |
path: | | |
data | |
README.md | |
LICENSE.md | |
THIRDPARTY.md | |
${{ github.workspace }}/bin/**/AtlasEngineDemo.exe | |
${{ github.workspace }}/bin/**/AtlasEngineEditor.exe | |
${{ github.workspace }}/bin/**/*.dll | |
!**/CMakeFiles | |
compression-level: 9 | |
linux-build: | |
runs-on: ubuntu-latest | |
name: Build on Linux | |
# Run both builds in parallel and don't cancel if one fails | |
strategy: | |
matrix: | |
build-type: [Release] | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Vcpkg | |
uses: friendlyanon/setup-vcpkg@v1 | |
# Committish: The commit sha of the vcpkg repo, same as in vcpkg.json | |
with: | |
committish: 821100d967e1737d96414a308e3f7cbe0d1abf18 | |
- name: Setup Ninja | |
uses: ashutoshvarma/setup-ninja@master | |
with: | |
# ninja version to download. Default: 1.10.0 | |
version: 1.10.0 | |
- name: Install Vulkan SDK | |
uses: humbletim/[email protected] | |
with: | |
version: 1.3.261.1 | |
cache: true | |
- name: Run scripts | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt-get install libgl1-mesa-dev | |
cd ${{ github.workspace }} | |
${{ github.workspace }}/vcpkg/vcpkg install --clean-after-build --triplet=x64-linux | |
rm -r vcpkg_installed | |
# https://github.com/marketplace/actions/setup-ninja | |
- name: Build ${{ matrix.build-type }} configuration with CMake | |
uses: ashutoshvarma/action-cmake-build@master | |
with: | |
build-dir: ${{ github.workspace }}/build/${{ matrix.build-type }} | |
source-dir: ${{ github.workspace }} | |
cc: "gcc" | |
cxx: "g++" | |
configure-options: -G Ninja -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake' | |
-DASSIMP_BUILD_TESTS=OFF -DASSIMP_BUILD_ASSIMP_TOOLS=OFF -DATLAS_DEMO=ON -DATLAS_TESTS=OFF -DATLAS_EDITOR=ON | |
parallel: 16 | |
build-type: ${{ matrix.build-type }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Atlas Engine Linux | |
path: | | |
data | |
README.md | |
LICENSE.md | |
THIRDPARTY.md | |
${{ github.workspace }}/bin/**/AtlasEngineDemo | |
${{ github.workspace }}/bin/**/AtlasEngineEditor | |
${{ github.workspace }}/bin/**/*.so* | |
!**/CMakeFiles | |
compression-level: 9 | |
macos-build: | |
runs-on: macos-latest | |
name: Build on MacOS | |
# Run both builds in parallel and don't cancel if one fails | |
strategy: | |
matrix: | |
build-type: [Release] | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Vcpkg | |
uses: friendlyanon/setup-vcpkg@v1 | |
# Committish: The commit sha of the vcpkg repo, same as in vcpkg.json | |
with: | |
committish: 821100d967e1737d96414a308e3f7cbe0d1abf18 | |
- name: Setup Ninja | |
uses: ashutoshvarma/setup-ninja@master | |
with: | |
# ninja version to download. Default: 1.10.0 | |
version: 1.10.0 | |
- name: Install Vulkan SDK | |
uses: humbletim/[email protected] | |
with: | |
version: 1.3.261.1 | |
cache: true | |
- name: Run scripts | |
shell: bash | |
# Add additional scripting steps here | |
run: | | |
cd ${{ github.workspace }} | |
brew install pkg-config | |
${{ github.workspace }}/vcpkg/vcpkg install --clean-after-build --triplet=arm64-osx | |
rm -r vcpkg_installed | |
# https://github.com/marketplace/actions/setup-ninja | |
- name: Build ${{ matrix.build-type }} configuration with CMake | |
uses: ashutoshvarma/action-cmake-build@master | |
with: | |
build-dir: ${{ github.workspace }}/build/${{ matrix.build-type }} | |
source-dir: ${{ github.workspace }} | |
cc: "clang" | |
cxx: "clang++" | |
configure-options: -DCMAKE_TOOLCHAIN_FILE='${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake' | |
-DATLAS_DEMO=ON -DATLAS_TESTS=OFF -DATLAS_EDITOR=ON -G Ninja | |
parallel: 16 | |
build-type: ${{ matrix.build-type }} | |
- name: Build bundle | |
shell: bash | |
run: | | |
cd ${{ github.workspace }}/build/${{ matrix.build-type }} | |
cmake --install . --config ${{ matrix.build-type }} | |
{ | |
echo '<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>com.apple.security.files.downloads.read-write</key> | |
<true/> | |
<key>com.apple.security.files.documents.read-write</key> | |
<true/> | |
</dict> | |
</plist>' | |
} >engine.entitlements | |
codesign --force --deep -s - --entitlements engine.entitlements AtlasEngineEditor.app | |
codesign --force --deep -s - --entitlements engine.entitlements AtlasEngineDemo.app | |
tar -cvf AtlasEngineEditor.tar AtlasEngineEditor.app | |
tar -cvf AtlasEngineDemo.tar AtlasEngineDemo.app | |
cp AtlasEngineEditor.tar ${{ github.workspace }}/bin/${{ matrix.build-type }}/AtlasEngineEditor.tar | |
cp AtlasEngineDemo.tar ${{ github.workspace }}/bin/${{ matrix.build-type }}/AtlasEngineDemo.tar | |
- name: Upload artifact | |
if: ${{ matrix.build-type == 'Release' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Atlas Engine MacOS | |
path: | | |
data | |
README.md | |
LICENSE.md | |
THIRDPARTY.md | |
${{ github.workspace }}/bin/**/AtlasEngineDemo.tar | |
${{ github.workspace }}/bin/**/AtlasEngineEditor.tar | |
${{ github.workspace }}/bin/**/*.dylib* | |
!**/CMakeFiles | |
compression-level: 9 | |
release: | |
runs-on: ubuntu-latest | |
name: Create a new release | |
environment: release | |
needs: [windows-build, linux-build, macos-build] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ${{ github.workspace }} | |
- name: Install zip | |
uses: montudor/action-zip@v1 | |
- name: Zip Windows artifact | |
run: zip -r "Atlas Engine Windows.zip" "Atlas Engine Windows" | |
working-directory: ${{ github.workspace }} | |
- name: Zip Linux artifact | |
run: zip -r "Atlas Engine Linux.zip" "Atlas Engine Linux" | |
working-directory: ${{ github.workspace }} | |
- name: Zip Linux artifact | |
run: zip -r "Atlas Engine MacOS.zip" "Atlas Engine MacOS" | |
working-directory: ${{ github.workspace }} | |
- name: Create tag | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ github.event.inputs.release_version }}', | |
sha: context.sha | |
}) | |
- name: Build Changelog | |
id: build_changelog | |
uses: mikepenz/release-changelog-builder-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.release_version }} | |
release_name: Release ${{ github.event.inputs.release_version }} | |
draft: true | |
prerelease: false | |
body: | | |
# Changes in this release | |
${{steps.build_changelog.outputs.changelog}} | |
### Change metrics | |
${{steps.build_changelog.outputs.changed_files}} files were changed | |
Added ${{steps.build_changelog.outputs.additions}} lines | |
Removed ${{steps.build_changelog.outputs.deletions}} lines | |
${{steps.build_changelog.outputs.commits}} total commits | |
- name: Upload Windows Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "${{ github.workspace }}/Atlas Engine Windows.zip" | |
asset_name: "AtlasEngineWindows.zip" | |
asset_content_type: application/zip | |
- name: Upload Linux Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "${{ github.workspace }}/Atlas Engine Linux.zip" | |
asset_name: "AtlasEngineLinux.zip" | |
asset_content_type: application/zip | |
- name: Upload MacOS Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "${{ github.workspace }}/Atlas Engine MacOS.zip" | |
asset_name: "AtlasEngineMacOS.zip" | |
asset_content_type: application/zip |