-
-
Notifications
You must be signed in to change notification settings - Fork 50
125 lines (119 loc) · 4.8 KB
/
release.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
# Copyright 2019 - 2020 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
on:
push:
tags:
- 'v*'
pull_request:
name: Create Release
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
env:
DEP_DIR: ${{github.workspace}}/dependencies
BOOST_VERSION: 1.56.0
steps:
- uses: actions/checkout@v4
- name: Extract tag name
id: get_tag
run: |
echo "Running for $GITHUB_EVENT_NAME event"
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
else
version=$(grep "set(_version " CMakeLists.txt | head -n1 | sed 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')
echo "::set-output name=tag::v$version"
fi
- name: Sanity check version
run: |
version=${{steps.get_tag.outputs.tag}}
echo "Expecting version $version"
if ! grep -q "set(_version ${version#v})" CMakeLists.txt; then
echo "Version mismatch."
echo "Expected '${version#v}', found '$(grep -E 'set\(_version [0-9]' CMakeLists.txt)'"
exit 1
fi
- name: Create documentation
run: |
sudo apt-get install doxygen
doc/gendoc.sh
tar -czf documentation.tar.gz doc index.html
- name: Create standalone version
run: |
bash tools/create_standalone.sh nowide_standalone_${{steps.get_tag.outputs.tag}}
tar -czf nowide_standalone.tar.gz nowide_standalone_${{steps.get_tag.outputs.tag}}
- name: Test standalone release tarball
run: |
tmp_dir=$(mktemp -d -p "$RUNNER_TEMP")
cd "$tmp_dir"
tar -xf "${{github.workspace}}/nowide_standalone.tar.gz"
src_dir="$PWD/nowide_standalone_${{steps.get_tag.outputs.tag}}"
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/../install "$src_dir"
cmake --build . --config Debug --target tests
ctest --output-on-failure -C Debug --verbose
cmake --build . --config Debug --target install
- name: Create Boost version
run: |
FOLDER="nowide_${{steps.get_tag.outputs.tag}}"
mkdir "$FOLDER"
cp -r build cmake config include src test CMakeLists.txt Config.cmake.in "$FOLDER"
tar -czf nowide.tar.gz "$FOLDER"
- name: Install boost
run: sudo apt-get install -y libboost-all-dev
- name: Test Boost release tarball
run: |
tmp_dir=$(mktemp -d -p "$RUNNER_TEMP")
cd "$tmp_dir"
tar -xf "${{github.workspace}}/nowide.tar.gz"
src_dir="$PWD/nowide_${{steps.get_tag.outputs.tag}}"
mkdir build && cd build
cmake -DBoost_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/../install "$src_dir"
cmake --build . --config Debug --target tests
ctest --output-on-failure -C Debug --verbose
cmake --build . --config Debug --target install
- name: Create Release
if: github.event_name == 'push'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
UTF8-aware functions for Windows to make cross-platform easier
draft: false
prerelease: false
- name: Upload standalone version
if: github.event_name == 'push'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nowide_standalone.tar.gz
asset_name: nowide_standalone_${{steps.get_tag.outputs.tag}}.tar.gz
asset_content_type: application/tar.gz
- name: Upload Boost version
if: github.event_name == 'push'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nowide.tar.gz
asset_name: nowide_${{steps.get_tag.outputs.tag}}.tar.gz
asset_content_type: application/tar.gz
- name: Upload Documentation
if: github.event_name == 'push'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./documentation.tar.gz
asset_name: nowide_docu.tar.gz
asset_content_type: application/tar.gz