Skip to content

Commit 72c4c3f

Browse files
committed
add GitHub Action to build and release deb packages
1 parent 825f028 commit 72c4c3f

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

Diff for: .github/workflows/build-release.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Build and release x64 and ARM deb packages
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-release:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
submodules: true
17+
18+
- name: Create build environment (x64 and ARM)
19+
run: |
20+
mkdir -p ${{ github.workspace }}/build/linux-x64
21+
mkdir -p ${{ github.workspace }}/build/linux-arm
22+
23+
- name: Install cross-compilation toolchain
24+
run: |
25+
curl -L https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Stretch/GCC%206.3.0/Raspberry%20Pi%201%2C%20Zero/cross-gcc-6.3.0-pi_0-1.tar.gz/download | tar -xz -C /opt
26+
27+
- name: Configure CMake (x64)
28+
shell: bash
29+
working-directory: ${{ github.workspace }}/build/linux-x64
30+
run: cmake ${{ github.workspace }}
31+
32+
- name: Build deb package (x64)
33+
id: build_deb_x64
34+
shell: bash
35+
working-directory: ${{ github.workspace }}/build/linux-x64
36+
run: |
37+
make -j4 package
38+
echo "::set-output name=X64_DEB_PACKAGE::$(basename $(find . -maxdepth 1 -name *.deb))"
39+
40+
- name: Configure CMake (ARM)
41+
shell: bash
42+
working-directory: ${{ github.workspace }}/build/linux-arm
43+
run: cmake -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/rpi-toolchain.cmake ${{ github.workspace }}
44+
45+
- name: Build deb package (ARM)
46+
id: build_deb_arm
47+
shell: bash
48+
working-directory: ${{ github.workspace }}/build/linux-arm
49+
run: |
50+
make -j4 package
51+
echo "::set-output name=ARM_DEB_PACKAGE::$(basename $(find . -maxdepth 1 -name *.deb))"
52+
53+
- name: Create release
54+
id: create_release
55+
uses: actions/create-release@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
tag_name: ${{ github.ref }}
60+
release_name: Release ${{ github.ref }}
61+
draft: false
62+
prerelease: false
63+
64+
- name: Upload release asset (x64)
65+
uses: actions/upload-release-asset@v1
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
70+
asset_path: ${{ github.workspace }}/build/linux-x64/${{ steps.build_deb_x64.outputs.X64_DEB_PACKAGE }}
71+
asset_name: ${{ steps.build_deb_x64.outputs.X64_DEB_PACKAGE }}
72+
asset_content_type: application/vnd.debian.binary-package
73+
74+
- name: Upload release asset (ARM)
75+
uses: actions/upload-release-asset@v1
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
upload_url: ${{ steps.create_release.outputs.upload_url }}
80+
asset_path: ${{ github.workspace }}/build/linux-arm/${{ steps.build_deb_arm.outputs.ARM_DEB_PACKAGE }}
81+
asset_name: ${{ steps.build_deb_arm.outputs.ARM_DEB_PACKAGE }}
82+
asset_content_type: application/vnd.debian.binary-package

0 commit comments

Comments
 (0)