-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (116 loc) · 3.56 KB
/
Copy pathrelease.yml
File metadata and controls
140 lines (116 loc) · 3.56 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build and Release
on:
push:
branches:
- main
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows x86_64
id: windows-x86_64
runner: windows-2022
generator: Visual Studio 17 2022
platform: x64
osx_architectures: ""
- name: Ubuntu 22.04 x86_64
id: ubuntu-22.04-x86_64
runner: ubuntu-22.04
generator: Ninja
platform: ""
osx_architectures: ""
- name: Ubuntu 22.04 arm64
id: ubuntu-22.04-arm64
runner: ubuntu-22.04-arm
generator: Ninja
platform: ""
osx_architectures: ""
# - name: macOS x86_64
# id: macos-x86_64
# runner: macos-13
# generator: Ninja
# platform: ""
# osx_architectures: ""
# - name: macOS arm64
# id: macos-arm64
# runner: macos-14
# generator: Ninja
# platform: ""
# osx_architectures: ""
- name: macOS universal
id: macos-universal
runner: macos-14
generator: Ninja
platform: ""
osx_architectures: x86_64;arm64
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Configure
shell: bash
run: |
cmake_args=(-S . -B build -G "${{ matrix.generator }}")
if [ -n "${{ matrix.platform }}" ]; then
cmake_args+=(-A "${{ matrix.platform }}")
fi
if [ -n "${{ matrix.osx_architectures }}" ]; then
cmake_args+=("-DCMAKE_OSX_ARCHITECTURES=${{ matrix.osx_architectures }}")
fi
if [ "${{ runner.os }}" != "Windows" ]; then
cmake_args+=(-DCMAKE_BUILD_TYPE=Release)
fi
cmake "${cmake_args[@]}"
- name: Build and package
shell: bash
run: cmake --build build --config Release --target package
- name: Upload package artifact
uses: actions/upload-artifact@v7
with:
name: package-${{ matrix.id }}
path: build/*.zip
if-no-files-found: error
release:
name: Create release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
needs: build
steps:
- name: Download packages
uses: actions/download-artifact@v7
with:
pattern: package-*
path: dist
merge-multiple: true
- name: Create or update GitHub release
shell: bash
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
tag_name="ci-${GITHUB_SHA}"
release_title="CI build ${GITHUB_SHA:0:12}"
release_flags=(--prerelease)
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
tag_name="${GITHUB_REF_NAME}"
release_title="${GITHUB_REF_NAME}"
release_flags=()
fi
notes="Automated packages for ${GITHUB_SHA}."
if gh release view "${tag_name}" >/dev/null 2>&1; then
gh release upload "${tag_name}" dist/*.zip --clobber
else
gh release create "${tag_name}" dist/*.zip \
--target "${GITHUB_SHA}" \
--title "${release_title}" \
--notes "${notes}" \
"${release_flags[@]}"
fi