-
-
Notifications
You must be signed in to change notification settings - Fork 9
110 lines (89 loc) · 2.65 KB
/
main.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
name: Build qnapexporter
on: # yamllint disable-line rule:truthy
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run tests
run: |
make test
- id: go
name: Set up Go environment
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: Build
run: |
make build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: qnapexporter
path: bin/qnapexporter
retention-days: 30
build-image-qdk:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build docker image with QDK
uses: docker/build-push-action@v6
with:
file: qpkg/Dockerfile
tags: qdk-image:latest
outputs: type=docker,dest=/tmp/qdk-image.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: qdk-image.tar
path: /tmp/qdk-image.tar
build-qpkg:
runs-on: ubuntu-latest
needs: [build, build-image-qdk]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download qnapexporter artifact
uses: actions/download-artifact@v4
with:
name: qnapexporter
path: qpkg/shared/
- name: Download qdk-image artifact
uses: actions/download-artifact@v4
with:
name: qdk-image.tar
path: /tmp
- name: Set git sha_short
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Prepare QPKG build
run: |
sed -i 's/QPKG_VER="0.0.0"/QPKG_VER="${{ steps.vars.outputs.sha_short }}"/g' ./qpkg/qpkg.cfg
chmod 755 qpkg/shared/qnapexporter
docker load --input /tmp/qdk-image.tar
- name: Build qpkg for qnapexporter
uses: addnab/docker-run-action@v3
with:
image: qdk-image:latest
options: -v ${{ github.workspace }}:/work
run: /usr/share/QDK/bin/qbuild --root /work/qpkg/
- name: Upload qpkg artifact
uses: actions/upload-artifact@v4
with:
name: QNAPExporter_${{ steps.vars.outputs.sha_short }}.qpkg
path: qpkg/build/QNAPExporter_${{ steps.vars.outputs.sha_short }}.qpkg
retention-days: 30