-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.93 KB
/
cpp-main.yml
File metadata and controls
61 lines (51 loc) · 1.93 KB
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
name: CI workflow
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build_project:
runs-on: ubuntu-latest
steps:
- name: Get repository code
uses: actions/checkout@v4
- name: Configure and build
run: |
cmake -B build .
cmake --build build --config Release
- name: Tests
run:
ctest --test-dir build -V
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.run_number }}
release_name: Release ${{ github.run_number }}
body: |
Auto release for the version ${{ github.run_number }}
prerelease: true
draft: false
- name: Upload Release Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: cmake-main-latest
asset_path: ./build/main
asset_content_type: application/octet-stream
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub #help
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/cmake-main:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/cmake-main:latest