Skip to content

Always overwrite nCine_DIR and CMAKE_PREFIX_PATH #41

Always overwrite nCine_DIR and CMAKE_PREFIX_PATH

Always overwrite nCine_DIR and CMAKE_PREFIX_PATH #41

Workflow file for this run

name: 'Windows'
env:
DEPLOY_MESSAGE:
"Push artifact from GitHub Actions build ${{ github.run_number }} with id ${{ github.run_id }}
- ncline artifact from branch 'BRANCH_NAME' with commit id ${{ github.sha }}"
DEPLOY_BRANCH: ncline-BRANCH_NAME-OS-COMPILER
on: [push, workflow_dispatch]
jobs:
Windows:
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: 'Checkout Code'
uses: actions/checkout@v4
- name: 'Unshallow Git Repository for Versioning'
run: |
$env:GIT_REDIRECT_STDERR = '2>&1'
git fetch --unshallow; if (-not $?) { return }
- name: 'CMake Configuration'
run: |
$env:generator = switch ("${{ matrix.os }}")
{
"windows-2022" {"Visual Studio 17 2022"}
"windows-2019" {"Visual Studio 16 2019"}
}
cmake -G "$env:generator" -A x64 -B ../ncline-build-Release
- name: 'CMake Build'
run: |
cmake --build ../ncline-build-Release --config Release
- name: 'Package'
run: |
cmake --build ../ncline-build-Release --config Release --target package
- name: 'Push Artifacts'
env:
PUBLIC_REPO_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
$env:GIT_REDIRECT_STDERR = '2>&1'
$env:branch_name = git describe --tags --exact-match; if (-not $?) { $env:branch_name = git symbolic-ref -q --short HEAD }; if (-not $?) { $env:branch_name = git rev-parse --short HEAD }
$env:DEPLOY_MESSAGE = $env:DEPLOY_MESSAGE -replace "BRANCH_NAME",$env:branch_name
$env:vsversion = switch ("${{ matrix.os }}")
{
"windows-2022" {"vs2022"}
"windows-2019" {"vs2019"}
}
$env:DEPLOY_BRANCH = $env:DEPLOY_BRANCH -replace "BRANCH_NAME",$env:branch_name
$env:DEPLOY_BRANCH = $env:DEPLOY_BRANCH -replace "OS","windows" -replace "COMPILER",$env:vsversion
cd ..
git clone https://$env:PUBLIC_REPO_TOKEN@github.com/nCine/ncline-artifacts.git 2>&1>$null
cd ncline-artifacts
git checkout $env:DEPLOY_BRANCH; if (-not $?) { git checkout --orphan $env:DEPLOY_BRANCH }
git reset
git clean -f
git rm *
Move-Item -Path ..\ncline-build-Release\*.zip -Destination .
git add *.zip
git commit --amend -m "$env:DEPLOY_MESSAGE"; if (-not $?) { git commit -m "$env:DEPLOY_MESSAGE" }
git push --force; if (-not $?) { git push --set-upstream origin $env:DEPLOY_BRANCH }