Skip to content

Fixed typo

Fixed typo #266

Workflow file for this run

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/[email protected]
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