-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (92 loc) · 3.56 KB
/
build-and-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
on:
push:
tags:
- '*'
name: Build and release
jobs:
x86_64:
name: Build for x86_64
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Get version from tag
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build
run: |
make
- name: Upload artifact
uses: actions/upload-artifact@master
with:
name: axisdiscovery-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-gnu
path: ./axisdiscovery-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-gnu
armhf:
name: Build for armhf
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Get version from tag
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Install compiler
run: |
sudo apt-get update -qq
sudo apt-get install -y gcc-arm-linux-gnueabihf
- name: Build
run: |
CC=arm-linux-gnueabihf-gcc make
- name: Upload artifact
uses: actions/upload-artifact@master
with:
name: axisdiscovery-${{ steps.get_version.outputs.VERSION }}-arm-linux-gnueabihf
path: ./axisdiscovery-${{ steps.get_version.outputs.VERSION }}-arm-linux-gnueabihf
release:
name: Create GitHub release
needs: [x86_64, armhf]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Get version from tag
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Fetch artifact (x86_64)
uses: actions/download-artifact@master
with:
name: axisdiscovery-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-gnu
- name: Fetch artifact (armhf)
uses: actions/download-artifact@master
with:
name: axisdiscovery-${{ steps.get_version.outputs.VERSION }}-arm-linux-gnueabihf
- name: Create release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload release (x86_64)
id: upload-release-asset-x86_64
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./axisdiscovery-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-gnu/axisdiscovery-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-gnu
asset_name: axisdiscovery-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-gnu
asset_content_type: application/octet-stream
- name: Upload release (armhf)
id: upload-release-asset-armhf
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./axisdiscovery-${{ steps.get_version.outputs.VERSION }}-arm-linux-gnueabihf/axisdiscovery-${{ steps.get_version.outputs.VERSION }}-arm-linux-gnueabihf
asset_name: axisdiscovery-${{ steps.get_version.outputs.VERSION }}-arm-linux-gnueabihf
asset_content_type: application/octet-stream