prepare github release flow and version handling
This commit is contained in:
parent
f3873cf6b3
commit
712829c7e4
|
@ -0,0 +1,64 @@
|
|||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: createRelease
|
||||
|
||||
# Controls when the action will run.
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the master branch
|
||||
push:
|
||||
branches: [ release ]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
release:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
#set version
|
||||
- name: set version
|
||||
id: version
|
||||
run: echo "::set-output name=version::$(date +'%Y%m%d')"
|
||||
- name: Install deps
|
||||
run: |
|
||||
#apt-get update
|
||||
#apt-get install -y python3-pip nodejs
|
||||
python3 -m pip install --upgrade pip
|
||||
pip install -U platformio
|
||||
# Runs a single command using the runners shell
|
||||
- name: build package
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version}}
|
||||
PLATFORMIO_BUILD_FLAGS: "-DGWRELEASEVERSION=${{ steps.version.outputs.version}}"
|
||||
run: pio run
|
||||
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.version.outputs.version}}
|
||||
release_name: ${{ steps.version.outputs.version }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
- name: Upload Release Asset
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PKG_NAME: m5stack-atom
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||
asset_path: ./pio/build/${{ env.PKG_NAME }}/${{ env.PKG_NAME }}-all.bin
|
||||
asset_name: ${{ env.PKG_NAME }}-all.bin
|
||||
asset_content_type: application/octet-stream
|
|
@ -5,6 +5,8 @@ import os
|
|||
import sys
|
||||
import inspect
|
||||
import json
|
||||
from datetime import datetime
|
||||
Import("env")
|
||||
GEN_DIR='generated'
|
||||
CFG_FILE='web/config.json'
|
||||
FILES=['web/index.html',CFG_FILE,'web/index.js','web/index.css']
|
||||
|
@ -81,3 +83,5 @@ for f in FILES:
|
|||
print("compressing %s"%f)
|
||||
compressFile(f)
|
||||
generateCfg()
|
||||
version=datetime.now().strftime("%Y%m%d-%H%M")
|
||||
env.Append(CPPDEFINES=[('GWDEVVERSION',version)])
|
|
@ -0,0 +1,6 @@
|
|||
# Name, Type, SubType, Offset, Size, Flags
|
||||
otadata, data, ota, 0xe000, 0x2000,
|
||||
app0, app, ota_0, 0x10000, 0x140000,
|
||||
app1, app, ota_1, 0x150000,0x130000,
|
||||
nvs, data, nvs, 0x280000, 0x10000,
|
||||
spiffs, data, spiffs, 0x290000,0x170000,
|
|
|
@ -23,7 +23,10 @@ board_build.embed_files =
|
|||
generated/index.js.gz
|
||||
generated/index.css.gz
|
||||
generated/config.json.gz
|
||||
extra_scripts = pre:extra_script.py
|
||||
board_build.partitions = partitions_custom.csv
|
||||
extra_scripts =
|
||||
pre:extra_script.py
|
||||
post:post.py
|
||||
build_flags = -Igenerated
|
||||
|
||||
[env:m5stack-atom]
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
Import("env", "projenv")
|
||||
import os
|
||||
|
||||
print("##post script running")
|
||||
|
||||
def post(source,target,env):
|
||||
#print(env.Dump())
|
||||
esptool=env.get('UPLOADER')
|
||||
uploaderflags=env.subst("${UPLOADERFLAGS}")
|
||||
base=env.subst("$PIOENV")
|
||||
appoffset=env.subst("$ESP32_APP_OFFSET")
|
||||
firmware=env.subst("$BUILD_DIR/${PROGNAME}.bin")
|
||||
python=env.subst("$PYTHONEXE")
|
||||
print("base=%s,esptool=%s,appoffset=%s,uploaderflags=%s"%(base,esptool,appoffset,uploaderflags))
|
||||
uploadparts=uploaderflags.split(" ")
|
||||
#currently hardcoded last 8 parameters...
|
||||
if len(uploadparts) < 6:
|
||||
print("uploaderflags does not have enough parameter")
|
||||
return
|
||||
uploadfiles=uploadparts[-6:]
|
||||
for i in range(1,len(uploadfiles),2):
|
||||
if not os.path.isfile(uploadfiles[i]):
|
||||
print("file %s for combine not found"%uploadfiles[i])
|
||||
return
|
||||
offset=uploadfiles[0]
|
||||
outfile=os.path.join(env.subst("$BUILD_DIR"),base+"-all.bin")
|
||||
cmd=[python,esptool,"--chip","esp32","merge_bin","--target-offset",offset,"-o",outfile]
|
||||
cmd+=uploadfiles
|
||||
cmd+=[appoffset,firmware]
|
||||
print("running %s"%" ".join(cmd))
|
||||
env.Execute(" ".join(cmd),"#testpost")
|
||||
env.AddPostAction(
|
||||
"$BUILD_DIR/${PROGNAME}.bin",
|
||||
post
|
||||
)
|
14
src/main.cpp
14
src/main.cpp
|
@ -12,7 +12,17 @@
|
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#define VERSION "0.6.4"
|
||||
#define GWSTR(x) #x
|
||||
#ifdef GWRELEASEVERSION
|
||||
#define VERSION GWSTR(GWRELEASEVERSION)
|
||||
#define LOGLEVEL GwLog::ERROR
|
||||
#elif GWDEVVERSION
|
||||
#define VERSION GWSTR(GWDEVVERSION)
|
||||
#define LOGLEVEL GwLog::DEBUG
|
||||
#else
|
||||
#define VERSION "0.7.0"
|
||||
#define LOGLEVEL GwLog::DEBUG
|
||||
#endif
|
||||
|
||||
// #define GW_MESSAGE_DEBUG_ENABLED
|
||||
// #define FALLBACK_SERIAL
|
||||
|
@ -61,7 +71,7 @@ const unsigned long HEAP_REPORT_TIME=2000; //set to 0 to disable heap reporting
|
|||
typedef std::map<String,String> StringMap;
|
||||
|
||||
|
||||
GwLog logger(GwLog::DEBUG,NULL);
|
||||
GwLog logger(LOGLEVEL,NULL);
|
||||
GwConfigHandler config(&logger);
|
||||
#ifdef GWBUTTON_PIN
|
||||
bool fixedApPass=false;
|
||||
|
|
Loading…
Reference in New Issue