-
Notifications
You must be signed in to change notification settings - Fork 5
138 lines (120 loc) · 3.97 KB
/
package.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
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
name: JSON Schema
on:
push:
branches:
- main
tags:
- "v*.*.*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref_type }}
cancel-in-progress: false
permissions:
contents: write
jobs:
package:
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-22.04
cc: clang
cxx: clang++
shell: sh
- os: macos-13
cc: clang
cxx: clang++
shell: sh
- os: macos-14
cc: clang
cxx: clang++
shell: sh
- os: windows-latest
shell: pwsh
defaults:
run:
shell: ${{ matrix.platform.shell }}
runs-on: ${{ matrix.platform.os }}
env:
CC: ${{ matrix.platform.cc }}
CXX: ${{ matrix.platform.cxx }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies (macOS)
if: runner.os == 'macos'
run: brew bundle
env:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
- run: cmake --version
- name: Configure JSON Schema (Continuous)
if: github.ref_type == 'branch'
run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DJSONSCHEMA_TESTS:BOOL=ON
-DJSONSCHEMA_TESTS_CI:BOOL=ON
-DJSONSCHEMA_CONTINUOUS:BOOL=ON
-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
- name: Configure JSON Schema (Release)
if: github.ref_type == 'tag'
run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DJSONSCHEMA_TESTS:BOOL=ON
-DJSONSCHEMA_TESTS_CI:BOOL=ON
-DJSONSCHEMA_CONTINUOUS:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
- run: cmake --build ./build --config Release --parallel 4
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_jsonschema
# Not every CTest version supports the --test-dir option. If such option
# is not recognized, `ctest` will successfully exit finding no tests.
# Better to be sure and `cd` all the time here.
- run: cd ./build && ctest --build-config Release --output-on-failure --parallel
- run: cpack --config build/CPackConfig.cmake -B build/out -C Release
- uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.platform.os }}
path: build/out/*.zip
retention-days: 1
publish:
needs: package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: build/out/
pattern: artifacts-*
merge-multiple: true
- run: tree build
- run: gh config set prompt disabled
env:
GH_TOKEN: ${{ github.token }}
- name: Perform Continuous Release
run: |
gh release delete continuous --cleanup-tag --yes || true
gh release create continuous --prerelease --draft=false --title continuous --target "$GITHUB_SHA" --generate-notes
gh release upload --clobber continuous build/out/*.zip
if: github.ref_type == 'branch'
env:
GH_TOKEN: ${{ github.token }}
- name: Perform Tag Release
run: |
gh release create ${{ github.ref_name }} --draft=false --title ${{ github.ref_name }} --target "$GITHUB_SHA" --generate-notes
gh release upload --clobber ${{ github.ref_name }} build/out/*.zip
if: github.ref_type == 'tag'
env:
GH_TOKEN: ${{ github.token }}
- uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish to NPM
run: ./npm-deploy.sh ${{ github.ref_name }}
if: github.ref_type == 'tag'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}