-
Notifications
You must be signed in to change notification settings - Fork 63
164 lines (159 loc) · 6 KB
/
build.yaml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Build, Release and Deploy
on: [ push ]
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Prepare and checkout
uses: actions/checkout@v3
- name: Set environment variables
run: echo "VERSION=$(cat version)" >> $GITHUB_ENV
- name: Fail if Git-Tag already exist on main
if: github.ref == 'refs/heads/main'
run: |
TAG="v${{ env.VERSION }}"
git fetch
if git rev-parse -q --verify "refs/tags/${TAG}" > /dev/null; then
echo "Tag ${TAG} already exists"
exit 1
else
echo "Tag ${TAG} does not exist"
fi
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: '90 seconds'
skip-recent: 3
- name: Initialize Submodules
run: |
git submodule update --init --recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push docker development image
if: github.ref == 'refs/heads/dev'
uses: docker/build-push-action@v5
with:
context: ./endpoint
platforms: linux/amd64,linux/arm64
push: true
file: ./endpoint/Dockerfile_dev
tags: christld/macless-haystack:latest-dev,christld/macless-haystack:v${{ env.VERSION }}-${{ github.sha }},
- name: Build and push docker development image
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:endpoint"
platforms: linux/amd64,linux/arm64
push: true
tags: christld/macless-haystack:latest,christld/macless-haystack:v${{ env.VERSION }},
- name: Install ARM Toolchain
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '10-2020-q4'
- name: Install Nordic Toolchain
run: |
wget https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x/10-23-0/nrf-command-line-tools_10.23.0_amd64.deb
sudo dpkg -i nrf-command-line-tools_10.23.0_amd64.deb
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/flutter
key: ${{ runner.OS }}-flutter-install-cache
- uses: subosito/flutter-action@v2
- name: GH-Page Build
working-directory: ./macless_haystack
run: |
flutter pub get
flutter build web --profile --base-href "/macless-haystack/"
- name: Deploy to Github Pages
if: github.ref == 'refs/heads/dev'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./macless_haystack/build/web
- name: Web Build
working-directory: ./macless_haystack
run: |
flutter pub get
flutter build web --release
- name: Copy files to web application
run: |
mkdir -p ./macless_haystack/build/webapplication
cp -R ./macless_haystack/build/web ./macless_haystack/build/webapplication
cd ./macless_haystack/build/webapplication
zip -r webapplication.zip .
- name: Upload Web Artifacts
uses: actions/upload-artifact@v3
with:
name: webapplication
path: ./macless_haystack/build/webapplication
- name: Android Build
working-directory: ./macless_haystack
run: |
flutter build apk --release
mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/android-application.apk
- name: Upload Android Artifacts
uses: actions/upload-artifact@v3
with:
name: android-application
path: ./macless_haystack/build/app/outputs/flutter-apk/android-application.apk
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Build NRF5x firmware
run: |
cd firmware/nrf5x/
make build
make clean
NRF_MODEL=nrf51 make build
- name: Build ESP32 firmware
run: |
pio run -d firmware/ESP32/
cd firmware/ESP32/.pio/build/esp32dev/
zip -r esp32-firmware.zip firmware.bin partitions.bin bootloader.bin
- name: Upload firmware
uses: actions/upload-artifact@v3
with:
name: esp32-firmware
path: |
firmware/ESP32/.pio/build/esp32dev/firmware.bin
firmware/ESP32/.pio/build/esp32dev/partitions.bin
firmware/ESP32/.pio/build/esp32dev/bootloader.bin
- name: Delete old drafts
uses: hugo19941994/delete-draft-releases@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: v${{ env.VERSION }}
title: v${{ env.VERSION }}
draft: true
prerelease: false
files: |
generate_keys.py
firmware/ESP32/.pio/build/esp32dev/esp32-firmware.zip
firmware/nrf5x/compiled/*.bin
./macless_haystack/build/app/outputs/flutter-apk/android-application.apk
./macless_haystack/build/webapplication/webapplication.zip