update build action

pull/171/head
Peter Buchegger 2022-03-26 23:26:42 +01:00
rodzic 065c97ada4
commit bcbd174512
3 zmienionych plików z 38 dodań i 34 usunięć

Wyświetl plik

@ -1,6 +1,10 @@
name: Integreation Tests
on: [push, pull_request]
on:
push:
branches:
- '*'
- '!master'
jobs:
version_check:

Wyświetl plik

@ -1,46 +1,25 @@
name: Upload Release Assets
on:
push:
tags:
- 'v*'
name: Upload Release Assets
branches:
- 'master'
jobs:
build:
name: Upload Release Assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt-get install python3-setuptools python3-wheel
- run: pip3 install platformio
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- run: platformio run
- id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: echo "VERSION=$(echo ./scripts/create_version_tag.py)" >> $GITHUB_ENV
- uses: ncipollo/release-action@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
# upload firmware bin
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/lora_board/firmware.bin
asset_name: lora_board.bin
asset_content_type: application/bin
# upload json file
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: data/is-cfg.json
asset_name: is-cfg.json
asset_content_type: application/json
tag: ${{ env.VERSION }}
commit: Release ${{ env.VERSION }}
generateReleaseNotes: true
artifacts: ".pio/build/lora_board/firmware.bin,data/is-cfg.json"
token: ${{ secrets.GITHUB_TOKEN }}

Wyświetl plik

@ -0,0 +1,21 @@
#!/usr/bin/env python3
from datetime import date
today = date.today()
current_year = int(str(today.isocalendar()[0])[2:])
current_week = int(today.isocalendar()[1])
version = None
with open("src/LoRa_APRS_iGate.cpp") as f:
for line in f:
if line.startswith("#define VERSION"):
version = line.strip().split(" ")[-1].replace('"', "")
version_split = version.split(".")
version_year = int(version_split[0])
version_week = int(version_split[1])
version_vers = int(version_split[2])
print(f"v{version_year}.{version_week}.{version_vers}")