-
-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (62 loc) · 2.98 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: 'Windows'
env:
DEPLOY_FILE_NOEXT: nCine-external-OS-COMPILER-VERSION
DEPLOY_MESSAGE:
"Push artifact from GitHub Actions build ${{ github.run_number }} with id ${{ github.run_id }}
- nCine-libraries artifact from branch 'BRANCH_NAME' with commit id ${{ github.sha }}"
DEPLOY_BRANCH: libraries-OS-COMPILER
on: [push, workflow_dispatch]
jobs:
Windows:
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
BuildType: [Debug, Release]
runs-on: ${{ matrix.os }}
steps:
- name: 'Checkout code'
uses: actions/checkout@v3
- 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 ../nCine-libraries-build
- name: 'CMake Build'
run: |
cmake --build ../nCine-libraries-build --config ${{ matrix.BuildType }}
- name: 'Push Artifacts'
if: matrix.BuildType == 'Release'
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"}
}
git fetch --unshallow; if (-not $?) { return }
git describe --tags --long 2>$null; if ($?) { $env:git_version = git describe --tags --long 2>$null | %{$_ -replace "([^-]*-g)","r`$1" -replace "-","."} } else { $env:git_version = -join("r", $(git rev-list --count HEAD), ".", $(git rev-parse --short HEAD)) }
cd ..
$env:DEPLOY_FILE = -join($env:DEPLOY_FILE_NOEXT, ".7z")
$env:DEPLOY_FILE = $env:DEPLOY_FILE -replace "OS","windows" -replace "COMPILER",$env:vsversion -replace "VERSION",$env:git_version
$env:DEPLOY_BRANCH = $env:DEPLOY_BRANCH -replace "OS","windows" -replace "COMPILER",$env:vsversion
7z a $env:DEPLOY_FILE nCine-external
git clone https://$env:PUBLIC_REPO_TOKEN@github.com/nCine/nCine-libraries-artifacts.git 2>&1>$null
cd nCine-libraries-artifacts
git checkout $env:DEPLOY_BRANCH; if (-not $?) { git checkout --orphan $env:DEPLOY_BRANCH }
git reset
git clean -f
git rm *
Move-Item -Path ..\$env:DEPLOY_FILE -Destination .
git add $env:DEPLOY_FILE
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 }