-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (76 loc) · 2.66 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
name: Release
on:
push:
tags:
- "v*.*.*"
env:
BUILD_TYPE: Release
BUILD_PROJECT: no_tests
CC: gcc-11
CXX: g++-11
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Install ubuntu dependencies
run: sudo apt-get install ninja-build gcc-11 g++-11 libstdc++-11-dev clang-format
- name: Checkout the repository
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Attempt to use cached dependencies
id: cache-python
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
- name: Installing python dependencies
if: steps.cache-python.outputs.cache-hit != 'true'
run: pip install -r requirements.txt
- name: Attempt to use cached dependencies
id: cache-conan
uses: actions/cache@v2
with:
path: /home/runner/.conan
key: conan-cache-${{ hashFiles('conanfile.txt') }}-${{ env.BUILD_PROJECT }}
- name: Install conan dependencies
if: steps.cache-conan.outputs.cache-hit != 'true'
run: bash setup_build.sh
- name: Attempt to use cached build files
id: cache-cmake
uses: actions/cache@v2
with:
path: ${{github.workspace}}/build
key: cmake-cache-tmp-${{ hashFiles('CMakeLists.txt') }}-${{ env.BUILD_PROJECT }}
- name: Configure CMake
if: steps.cache-cmake.outputs.cache-hit != 'true'
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_PROJECT=${{env.BUILD_PROJECT}}
- name: Build
working-directory: ${{github.workspace}}/build
run: ninja all
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/bin/main
generate_release_notes: true
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for simulator
id: meta-simulator
uses: docker/metadata-action@v3
with:
images: ghcr.io/delta/codecharacter-simulator
- name: Build and push simulator image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta-simulator.outputs.tags }}
labels: ${{ steps.meta-simulator.outputs.labels }}