-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
46 lines (41 loc) · 1 KB
/
.gitlab-ci.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
stages:
- build
- upload
- deploy
variables:
MOS_ARTIFACT: "build/fw.zip"
FIRMWARE_FILE: "fw.zip"
.branch-rules:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
build:
extends:
- .branch-rules
stage: build
variables:
TARGET: 'Tanksensor2'
script:
- 'echo "Starting building the project using justfile"'
- 'cp /opt/gitlab-runner/tanksensor/.env .'
- 'TARGET="${TARGET}" just build'
- 'mv ${MOS_ARTIFACT} .'
artifacts:
name: 'firmware'
paths:
- $FIRMWARE_FILE
expire_in: 1 month
expose_as: 'firmware'
reports:
dotenv: .env
upload:
stage: upload
script:
- 'pwd'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $FIRMWARE_FILE "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}-firmware-${CI_COMMIT_SHORT_SHA}/latest/fw.zip"'
deploy_to_tanksensor:
dependencies:
- build
stage: deploy
when: manual
script:
- 'curl -v -F file=@${FIRMWARE_FILE} http://${DEVICE_ID}/update'