-
-
Notifications
You must be signed in to change notification settings - Fork 7
80 lines (62 loc) · 2.62 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
77
78
79
80
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 }