-
Notifications
You must be signed in to change notification settings - Fork 64
102 lines (83 loc) · 2.75 KB
/
ci.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
name: Build
on:
push:
branches: [main]
tags: ["v*.*.*"]
pull_request:
branches: [main]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Python Dependencies
run: pip install --upgrade meson==0.60.2 ninja
- name: MSVC Setup
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Meson Setup
run: meson --wrap-mode=forcefallback --buildtype=release --strip -Ddebug=true --prefix="${{ github.workspace }}/dist" build
- name: Build
run: ninja -C build
- name: Test
run: ninja -C build test
- name: Install
shell: bash
run: |
ninja -C build install
export VERSION=$(grep -m1 -o "version: '.*.'" meson.build | sed "s/version: '\(.*.\)'/\1/")
echo "ots_version=$VERSION" >> $GITHUB_ENV
mv -v dist/bin ots-$VERSION-${{ runner.os }}
- name: Archive
uses: thedoctor0/zip-release@master
with:
path: ots-${{ env.ots_version }}-${{ runner.os }}
filename: ots-${{ env.ots_version }}-${{ runner.os }}.zip
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ots-${{ env.ots_version }}-${{ runner.os }}
path: ots-*.zip
if-no-files-found: error
- name: Make Dist Tarball
if: matrix.os == 'ubuntu-latest'
run: meson dist -C build --no-tests
- name: Upload Dist Tarball
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: ots-${{ env.ots_version }}
path: build/meson-dist/ots-*.tar.xz
if-no-files-found: error
deploy:
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts from build jobs
uses: actions/download-artifact@v4
with:
path: dist
- name: Extract release notes from annotated tag message
run: |
# GH checkout action doesn't preserve tag annotations, we must fetch them
# https://github.com/actions/checkout/issues/290
git fetch --tags --force
echo "$(git tag -l --format='%(contents:body)' ${{ github.ref_name }})" > "${{ runner.temp }}/release_body.md"
echo "release_name=$(git tag -l --format='%(contents:subject)' ${{ github.ref_name }})" >> $GITHUB_ENV
- name: Publish
uses: softprops/action-gh-release@v2
with:
name: ${{ env.release_name }}
body_path: ${{ runner.temp }}/release_body.md
fail_on_unmatched_files: true
files: |
dist/*/*