Skip to content

Commit 20d4a67

Browse files
vossjannikpbruenn
authored andcommitted
CMake CI build + GitHub releases
Fixes: #178 Reviewed-by: Patrick Bruenn <p.bruenn@beckhoff.com>
1 parent 4603f43 commit 20d4a67

File tree

1 file changed

+61
-3
lines changed

1 file changed

+61
-3
lines changed

.github/workflows/build.yml

+61-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: build
22
on: push
33
jobs:
4-
build-ubuntu:
4+
build-ubuntu-meson:
55
runs-on: ubuntu-latest
66
steps:
77
- name: install meson
@@ -13,7 +13,65 @@ jobs:
1313
run: meson example/build example && ninja -C example/build
1414
- uses: actions/upload-artifact@v2
1515
with:
16-
name: ubuntu
16+
name: ubuntu-meson
1717
path: |
1818
build/
19-
example/build/
19+
example/build/ build-ubuntu:
20+
build-ubuntu-cmake:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: install ninja-build
24+
run: sudo apt update -y && sudo apt install -y ninja-build
25+
- uses: actions/checkout@v2
26+
- name: compile library
27+
run: cmake -S . -B build && cmake --build build
28+
- uses: actions/upload-artifact@v2
29+
with:
30+
name: ubuntu-cmake
31+
path: |
32+
build/
33+
collect-and-release:
34+
needs: [build-ubuntu-meson, build-ubuntu-cmake]
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v2
38+
- name: Download artifact ubuntu-meson
39+
uses: actions/download-artifact@v3
40+
with:
41+
name: ubuntu-meson
42+
path: ./build-ubuntu-meson
43+
- name: Download artifact ubuntu-cmake
44+
uses: actions/download-artifact@v3
45+
with:
46+
name: ubuntu-cmake
47+
path: ./build-ubuntu-cmake
48+
49+
- name: 'Compress files for the linux-x64 release artifact'
50+
shell: bash
51+
run: |
52+
zip --junk-paths ./linux-x64.zip ./build-ubuntu-cmake/**/*.so ./build-ubuntu-cmake/**/*.so.* ./build-ubuntu-meson/build/adstool
53+
54+
- name: 'Obtain the current version number from the debian changelog. We need it to create the release.'
55+
shell: bash
56+
run: |
57+
echo "GITHUB_ADSLIB_VERSION_NUMBER=$(dpkg-parsechangelog -SVersion --file ./debian/changelog)" >> $GITHUB_ENV
58+
- name: Create release
59+
if: startsWith(github.ref, 'refs/tags/v')
60+
id: create_release
61+
uses: actions/create-release@v1
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
tag_name: ${{ env.GITHUB_ADSLIB_VERSION_NUMBER }}
66+
release_name: ${{ env.GITHUB_ADSLIB_VERSION_NUMBER }}
67+
generate_release_notes: true
68+
- name: 'Upload release asset'
69+
if: steps.create_release.outcome == 'success'
70+
uses: actions/upload-release-asset@v1
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
with:
74+
upload_url: ${{ steps.create_release.outputs.upload_url }}
75+
asset_path: ./linux-x64.zip
76+
asset_name: linux-x64.zip
77+
asset_content_type: application/zip

0 commit comments

Comments
 (0)