generated from zenitheesc/new-zenith-template
-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (97 loc) · 3.17 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
name: Release
on:
push:
tags:
- 'v*'
env:
PROJECT_NAME: "modern-cpp-template"
BUILD_TYPE: Release
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Latest GCC",
artifact_ext: '.tar.gz',
os: ubuntu-latest,
cc: "gcc",
cxx: "g++",
}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: cache dependencies
uses: actions/cache@v2
id: cache
with:
path: ${{ github.HOME }}/.local
key: ${{ runner.os }}-dependencies
- name: install GoogleTest
if: ${{ steps.cache.output.cache-hit != 'true' }}
run: |
cd ..
git clone https://github.com/google/googletest.git --branch release-1.10.0
cd googletest
cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local" -Dgtest_force_shared_crt=1
cmake --build build --config Release
cmake --build build --target install --config Release
cd ../modern-cpp-template
- name: configure
run: cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local"
- name: build
run: cmake --build build --config "$env:BUILD_TYPE" -j4
- name: run tests
run: |
cd build
ctest -C "$env:BUILD_TYPE" -VV
# for a release not containing directly the source code, replace the files archived
# with the actual files needed (i.e. *.lib/*.a and *.h(pp))
release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: set version name
id: version
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/}
- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.version.outputs.name }}
# if needed, you can set the release body here
#body: "Release notes"
draft: false
prerelease: false
- name: download artifact
uses: actions/download-artifact@v2
with:
name: "Linux-${{ steps.version.outputs.name }}"
path: ./
- name: upload ubuntu release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifact.tar.gz"
asset_name: "${{ env.PROJECT_NAME }}-Linux-${{ steps.version.outputs.name }}.tar.gz"
asset_content_type: application/x-tar
- name: upload macos release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "./artifact.tar.gz"
asset_name: "${{ env.PROJECT_NAME }}-macOS-${{ steps.version.outputs.name }}.tar.gz"
asset_content_type: application/x-tar