18
18
env :
19
19
APP_NAME : module-core-loraraw
20
20
GHCR_IMAGE : ghcr.io/nubeio/module-core-loraraw
21
- PLATFORMS : linux/amd64,linux/arm/v7
21
+ PLATFORMS : linux/amd64
22
22
23
23
jobs :
24
24
25
25
context :
26
- runs-on : ubuntu-20 .04
26
+ runs-on : ubuntu-22 .04
27
27
28
28
outputs :
29
29
shouldBuild : ${{ steps.context.outputs.decision_build }}
36
36
fqn : ${{ env.APP_NAME }}-${{ steps.context.outputs.version }}-${{ steps.context.outputs.shortCommitId }}
37
37
38
38
steps :
39
- - uses : actions/checkout@v2
39
+ - uses : actions/checkout@v4
40
40
with :
41
41
token : ${{ secrets.NUBEIO_CI_GITHUBPROJECT_TOKEN }}
42
42
58
58
defaultBranch : master
59
59
60
60
build :
61
- runs-on : ubuntu-20 .04
61
+ runs-on : ubuntu-22 .04
62
62
needs : context
63
63
if : needs.context.outputs.shouldBuild == 'true'
64
64
env :
@@ -72,37 +72,22 @@ jobs:
72
72
-v /home/runner:/var/lib/registry
73
73
--name registry
74
74
steps :
75
- - uses : actions/checkout@v2
76
- - uses : actions/setup-go@v2
77
- with :
78
- go-version : ' ^1.16.6'
75
+ - uses : actions/checkout@v4
79
76
80
77
- name : Set current date as env variable
81
78
id : date
82
79
run : echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')"
83
80
84
- - name : Edit main.go for environment
85
- env :
86
- VERSION : ${{ needs.context.outputs.version }}
87
- COMMIT : ${{ needs.context.outputs.shortCommitId }}
88
- BUILD_DATE : ${{ steps.date.outputs.date }}
89
- run : |
90
- sed -i -e 's,<version>,'"${VERSION}"',' main.go
91
- sed -i -e 's/<commit>/'"${COMMIT}"'/' main.go
92
- sed -i -e 's/<build_date>/'"${BUILD_DATE}"'/' main.go
93
-
94
- - name : Build amd64
81
+ - name : Build inside Docker
95
82
run : |
96
- git config --global url."https://$GITHUB_TOKEN:x-oauth-basic@github.com/NubeIO".insteadOf "https://github.com/NubeIO"
97
- go mod tidy
98
- go build -o module-core-loraraw-amd64
83
+ docker build \
84
+ -f Dockerfile \
85
+ -t build-image .
99
86
100
- - name : Build armv7
101
- if : ${{ needs.context.outputs.isRelease == 'true' }}
102
- run : |
103
- sudo apt-get update -y
104
- sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
105
- env GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ go build -o module-core-loraraw-armv7
87
+ container_id=$(docker create build-image)
88
+ docker cp $container_id:/app/module-core-loraraw-amd64 ./module-core-loraraw-amd64
89
+ docker cp $container_id:/app/module-core-loraraw-armv7 ./module-core-loraraw-armv7
90
+ docker rm $container_id
106
91
107
92
- name : Zip artifacts
108
93
if : ${{ needs.context.outputs.isRelease == 'true' }}
0 commit comments