Merge pull request #1074 from haverland/rolling

Release creation like CaCo3's update-ota2
This commit is contained in:
jomjol
2022-09-25 18:27:28 +02:00
committed by GitHub
4 changed files with 156 additions and 114 deletions

View File

@@ -158,6 +158,18 @@ jobs:
name: "update__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
path: ./dist/*
- name: Store generated files in cache
uses: actions/cache@v3
with:
path: |
./code/.pio/build/esp32cam/firmware.bin
./code/.pio/build/esp32cam/partitions.bin
./code/.pio/build/esp32cam/bootloader.bin
./sd-card/html/version.txt
./dist
key: ${{ github.run_number }}-pack-for-OTA-v2
#########################################################################################
@@ -181,72 +193,98 @@ jobs:
./sd-card/html/version.txt
key: ${{ github.run_number }}
- name: Set Variables
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
#########################################################################################
## Prepare and create release
#########################################################################################
release:
runs-on: ubuntu-latest
needs: pack-for-OTA-v2
- name: Copy artifacts to firmware folder and create initial_esp32_setup.zip
run: |
mkdir -p firmware
# copy builds to firmware folder for committing in next step
cp -f "./code/.pio/build/esp32cam/firmware.bin" "firmware/firmware.bin"
cp -f "./code/.pio/build/esp32cam/bootloader.bin" "firmware/bootloader.bin"
cp -f "./code/.pio/build/esp32cam/partitions.bin" "firmware/partitions.bin"
cd sd-card
rm -f ../firmware/html.zip
rm -f ../firmware/README.md
zip -r ../firmware/html.zip html
mkdir ../dist
cd ../dist
steps:
- uses: actions/checkout@v2
- name: Upload initial_esp32_setup.zip artifact (Firmware + Bootloader + Partitions + Web UI + CNN)
uses: actions/upload-artifact@v3
with:
name: "initial_esp32_setup__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
path: ./firmware
- name: Get generated files from cache
uses: actions/cache@v3
with:
path: |
./code/.pio/build/esp32cam/firmware.bin
./code/.pio/build/esp32cam/partitions.bin
./code/.pio/build/esp32cam/bootloader.bin
./sd-card/html/version.txt
./dist
key: ${{ github.run_number }}-pack-for-OTA-v2
# extract the version used in next step
- id: get_version
if: startsWith(github.ref, 'refs/tags/')
uses: battila7/get-version-action@v2
- name: Set Variables
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
# the changelog [unreleased] will now be changed to the release version
- name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
changelogPath: Changelog.md
version: ${{ steps.get_version.outputs.version-without-v }}
- name: Prepare artifacts for release
run: |
ls -la ./dist
mkdir -p firmware
rm -rf firmware/*
mkdir -p release
# copy builds to firmware folder
cp -f "./code/.pio/build/esp32cam/firmware.bin" "firmware/firmware.bin"
cp -f "./code/.pio/build/esp32cam/bootloader.bin" "firmware/bootloader.bin"
cp -f "./code/.pio/build/esp32cam/partitions.bin" "firmware/partitions.bin"
zip -r ./firmware/sd-card.zip sd-card
# create a update.zip like "update__rolling"
cd ./dist
zip -r ../release/update.zip .
cd ../firmware
zip -r ../release/initial_esp32_setup.zip .
- name: Upload initial_esp32_setup.zip artifact (Firmware + Bootloader + Partitions + Web UI)
uses: actions/upload-artifact@v3
with:
name: "initial_esp32_setup__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
path: ./firmware
# extract the version used in next step
- id: get_version
if: startsWith(github.ref, 'refs/tags/')
uses: battila7/get-version-action@v2
# the changelog [unreleased] will now be changed to the release version
- name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
changelogPath: Changelog.md
version: ${{ steps.get_version.outputs.version-without-v }}
# the release notes will be extracted from changelog
- name: Extract release notes
id: extract-release-notes
if: startsWith(github.ref, 'refs/tags/')
uses: ffurrer2/extract-release-notes@v1
with:
changelog_file: Changelog.md
# the release notes will be extracted from changelog
- name: Extract release notes
id: extract-release-notes
if: startsWith(github.ref, 'refs/tags/')
uses: ffurrer2/extract-release-notes@v1
with:
changelog_file: Changelog.md
# Releases should only be created on master by tagging the last commit.
# all artifacts in firmware folder pushed to the release
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ steps.get_version.outputs.version-without-v }}
body: ${{ steps.extract-release-notes.outputs.release_notes }}
files: |
firmware/*
# Releases should only be created on master by tagging the last commit.
# all artifacts in firmware folder pushed to the release
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ steps.get_version.outputs.version-without-v }}
body: ${{ steps.extract-release-notes.outputs.release_notes }}
files: |
release/*
# Commit&Push Changelog to master branch. Must be manually merged back to rolling
- name: Commit changes and push changes
if: startsWith(github.ref, 'refs/tags/')
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add Changelog.md
git commit Changelog.md -m "Update Changelog.md for ${{github.event.inputs.versionIncrement}} release"
git push origin HEAD:master
# Commit&Push Changelog to master branch. Must be manually merged back to rolling
- name: Commit changes and push changes
if: startsWith(github.ref, 'refs/tags/')
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add Changelog.md
git commit Changelog.md -m "Update Changelog.md for ${{github.event.inputs.versionIncrement}} release"
git push origin HEAD:master

4
.gitignore vendored
View File

@@ -7,7 +7,9 @@
/sd-card/html/debug/
/firmware/
version.txt
/dist/
/dist_release/
/dist_old_ota
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles

View File

@@ -2,19 +2,15 @@
## [Unreleased]
## [11.3.9] - 2022-09-20
### Added
- auto release creation
### Changed
- something else
- automatic release creation
- newest firmware of rolling branch now uploaded to <https://github.com/jomjol/AI-on-the-edge-device/actions>
- \#1068 new safer and easier update mechanismn. Use only the update.zip of the release for firmware, html and new models.
### Fixed
- \#924 - fix of the Fix
- \#1029 wrong change of checkDigitConsistency now working like releases before 11.3.1
## [10.6.2] - (2022-07-24)
@@ -571,6 +567,10 @@ External Illumination
- Initial Version
[Unreleased]: https://github.com/haverland/AI-on-the-edge-device/compare/11.3.9...HEAD
[Unreleased]: https://github.com/haverland/AI-on-the-edge-device/compare/11.4.3...HEAD
[11.4.3]: https://github.com/haverland/AI-on-the-edge-device/compare/10.6.2...11.4.3
[11.4.2]: https://github.com/haverland/AI-on-the-edge-device/compare/10.6.2...11.4.2
[11.3.9]: https://github.com/haverland/AI-on-the-edge-device/compare/10.6.2...11.3.9

View File

@@ -752,57 +752,59 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st
mz_zip_archive_file_stat file_stat;
mz_zip_reader_file_stat(&zip_archive, i, &file_stat);
sprintf(archive_filename, file_stat.m_filename);
if (!file_stat.m_is_directory) {
// Try to extract all the files to the heap.
p = mz_zip_reader_extract_file_to_heap(&zip_archive, archive_filename, &uncomp_size, 0);
if (!p)
{
printf("mz_zip_reader_extract_file_to_heap() failed!\n");
mz_zip_reader_end(&zip_archive);
return ret;
}
// Save to File.
zw = std::string(archive_filename);
if (toUpper(zw) == "FIRMWARE.BIN")
{
zw = _target_bin + zw;
ret = zw;
}
else
{
std::string _dir = getDirectory(zw);
if (_dir.length() > 0)
if (!p)
{
zw = _main + zw;
printf("mz_zip_reader_extract_file_to_heap() failed on file %s\n", archive_filename);
mz_zip_reader_end(&zip_archive);
return ret;
}
// Save to File.
zw = std::string(archive_filename);
if (toUpper(zw) == "FIRMWARE.BIN")
{
zw = _target_bin + zw;
ret = zw;
}
else
{
zw = _target_zip + zw;
std::string _dir = getDirectory(zw);
if (_dir.length() > 0)
{
zw = _main + zw;
}
else
{
zw = _target_zip + zw;
}
}
string filename_zw = zw + SUFFIX_ZW;
printf("Filename to extract: %s, Zwischenfilename: %s", zw.c_str(), filename_zw.c_str());
// extrahieren in zwischendatei
DeleteFile(filename_zw);
FILE* fpTargetFile = OpenFileAndWait(filename_zw.c_str(), "wb");
fwrite(p, 1, (uint)uncomp_size, fpTargetFile);
fclose(fpTargetFile);
DeleteFile(zw);
RenameFile(filename_zw, zw);
DeleteFile(filename_zw);
printf("Successfully extracted file \"%s\", size %u\n", archive_filename, (uint)uncomp_size);
// printf("File data: \"%s\"\n", (const char*)p);
// We're done.
mz_free(p);
}
string filename_zw = zw + SUFFIX_ZW;
printf("Filename to extract: %s, Zwischenfilename: %s", zw.c_str(), filename_zw.c_str());
// extrahieren in zwischendatei
DeleteFile(filename_zw);
FILE* fpTargetFile = OpenFileAndWait(filename_zw.c_str(), "wb");
fwrite(p, 1, (uint)uncomp_size, fpTargetFile);
fclose(fpTargetFile);
DeleteFile(zw);
RenameFile(filename_zw, zw);
DeleteFile(filename_zw);
printf("Successfully extracted file \"%s\", size %u\n", archive_filename, (uint)uncomp_size);
// printf("File data: \"%s\"\n", (const char*)p);
// We're done.
mz_free(p);
}
// Close the archive, freeing any resources it was using