Build Firmware custom by @derskythe #118
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Firmware | |
run-name: "Build Firmware ${{ github.ref_name }} by @${{ github.ACTOR }}" | |
# Manual trigger | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "github-actions", "custom" ] | |
env: | |
FBT_NO_SYNC: 0 | |
WORKFLOW_BRANCH_OR_TAG: "dev-cfw" | |
DEV_NAME: "dev" | |
FORCE_NO_DIRTY: yes | |
URL_FW: "https://github.com/${{ vars.REPO_UNLEASHED }}.git" | |
DIST_SUFFIX: "${{ vars.FIRMWARE_VERSION }}" | |
TGZ_NAME_EXTRA_APPS: "flipper-z-f7-update-${{ vars.FIRMWARE_VERSION }}e.tgz" | |
ZIP_NAME_DEFAULT_APPS: "flipper-z-f7-update-${{ vars.FIRMWARE_VERSION }}.zip" | |
TGZ_NAME_DEFAULT_APPS: "flipper-z-f7-update-${{ vars.FIRMWARE_VERSION }}.tgz" | |
ARTIFACTS_APPS_EXTRA: "artifacts-extra-apps" | |
ARTIFACTS_APPS_DEFAULT: "artifacts-default" | |
# Extra | |
TGZ_FULL_NAME_EXTRA_APPS: "artifacts-extra-apps/flipper-z-f7-update-${{ vars.FIRMWARE_VERSION }}e.tgz" | |
# Default | |
TGZ_FULL_NAME_DEFAULT_APPS: "artifacts-default/flipper-z-f7-update-${{ vars.FIRMWARE_VERSION }}.tgz" | |
ZIP_FULL_NAME_DEFAULT_APPS: "artifacts-default/flipper-z-f7-update-${{ vars.FIRMWARE_VERSION }}.zip" | |
ARTIFACTS_APPS_EXTRA_DIR: "artifacts-extra-apps/f7-update-${{ vars.FIRMWARE_VERSION }}" | |
ARTIFACTS_APPS_DEFAULT_DIR: "artifacts-default/f7-update-${{ vars.FIRMWARE_VERSION }}" | |
ZIP_TAG_DEFAULT_APPS: "" | |
TGZ_TAG_DEFAULT_APPS: "" | |
TGZ_TAG_EXTRA_APPS: "" | |
jobs: | |
build-with-extra-apps: | |
#needs: checkout-with-extra-apps | |
name: Build firmware for branch ${{ github.ref_name }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: "[ALL] Checkout firmware repo π " | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
clean: true | |
- name: "[ALL] Checkout SubBruteForce π " | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
clean: true | |
repository: "derskythe/flipperzero-subbrute" | |
path: applications_user/subbrute | |
- name: "[ALL] Remove examples and debug apps βοΈ" | |
shell: pwsh # rm to remove a problem with FAP, which includes non-existent files | |
run: | | |
Remove-Item -Force -Recurse ./applications/debug -ErrorAction SilentlyContinue | |
Remove-Item -Force -Recurse ./applications/examples -ErrorAction SilentlyContinue | |
Remove-Item -Force -Recurse ./applications/main/clock_app/resources/apps/ -ErrorAction SilentlyContinue | |
- name: "[ALL] Download base and extra packages ποΈ" | |
shell: pwsh # rm to remove a problem with FAP, which includes non-existent files | |
run: | | |
Invoke-WebRequest -URI https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-extra.tgz -OutFile all-the-apps-extra.tgz | |
Invoke-WebRequest -URI https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz -OutFile all-the-apps-base.tgz | |
if ( -not (Test-Path all-the-apps-extra.tgz) -or -not (Test-Path all-the-apps-base.tgz) ) { | |
Write-Error "Failed to download all-the-apps-extra.tgz or all-the-apps-base.tgz" | |
exit 1 | |
} | |
- name: "[ALL] First Build Run β" | |
run: | | |
./fbt COMPACT=1 DEBUG=0 updater_package | |
- name: "[DEFAULT] Unpack package π₯" | |
shell: bash | |
run: | | |
mkdir -p applications/main/clock_app/resources/apps | |
mkdir -p applications/main/clock_app/resources/apps_data | |
tar -zxvf all-the-apps-base.tgz | |
cp -R base_pack_build/artifacts-base/* applications/main/clock_app/resources/apps/ | |
cp -R base_pack_build/apps_data/* applications/main/clock_app/resources/apps_data/ | |
rm -rf base_pack_build all-the-apps-base.tgz | |
- name: "[DEFAULT] Build firmware π₯β" | |
shell: bash | |
run: | | |
rm -rf build/f7-firmware-C/toolbox/version.* | |
./fbt COMPACT=1 DEBUG=0 updater_package | |
- name: "[DEFAULT] Post Build π₯π" | |
shell: bash | |
run: | | |
mkdir ${{ env.ARTIFACTS_APPS_DEFAULT }} | |
mv -f dist/f7-C/* ${{ env.ARTIFACTS_APPS_DEFAULT }}/ | |
echo 'List ${{ env.ARTIFACTS_APPS_DEFAULT }}' | |
ls -laS ${{ env.ARTIFACTS_APPS_DEFAULT }} | |
echo 'List ${{ env.ARTIFACTS_APPS_DEFAULT_DIR }}' | |
ls -laS "${{ env.ARTIFACTS_APPS_DEFAULT_DIR }}" | |
rm -rf applications/main/clock_app/resources/apps/ | |
- name: "[EXTRA] Unpack package π₯" | |
shell: bash | |
run: | | |
tar -zxvf all-the-apps-extra.tgz | |
mkdir -p applications/main/clock_app/resources/apps | |
cp -R extra_pack_build/artifacts-extra/* applications/main/clock_app/resources/apps/ | |
rm -rf extra_pack_build all-the-apps-extra.tgz | |
- name: "[EXTRA] Build firmware apps π₯β" | |
shell: bash | |
env: | |
DIST_SUFFIX: ${{ vars.FIRMWARE_VERSION }}e | |
run: | | |
rm -rf build/f7-firmware-C/toolbox/version.* | |
./fbt COMPACT=1 DEBUG=0 updater_package | |
- name: "[EXTRA] Post Build apps π₯π" | |
shell: bash | |
run: | | |
mkdir ${{ env.ARTIFACTS_APPS_EXTRA }} | |
mv -f dist/f7-C/* ${{ env.ARTIFACTS_APPS_EXTRA }}/ | |
echo 'List ${{ env.ARTIFACTS_APPS_EXTRA }}' | |
ls -laS ${{ env.ARTIFACTS_APPS_EXTRA }} | |
# echo 'List ${{ env.ARTIFACTS_APPS_EXTRA_DIR }}' | |
# ls -laS "${{ env.ARTIFACTS_APPS_EXTRA_DIR }}" | |
- name: "[ALL] Bundle Self-update packages π¦" | |
shell: bash | |
run: | | |
cp ${{ env.TGZ_FULL_NAME_EXTRA_APPS }} . | |
cp ${{ env.TGZ_FULL_NAME_DEFAULT_APPS }} . | |
zip -r ${{ env.ZIP_FULL_NAME_DEFAULT_APPS }} ${{ env.ARTIFACTS_APPS_DEFAULT_DIR }} | |
tar -czpf ${{ env.ARTIFACTS_APPS_DEFAULT }}/flipper-z-any-scripts-${{ vars.FIRMWARE_VERSION }}.tgz scripts | |
mkdir -p ${{ vars.FIRMWARE_VERSION }} | |
mv -f ${{ env.ARTIFACTS_APPS_DEFAULT }}/*.tgz ${{ vars.FIRMWARE_VERSION }}/ | |
mv -f ${{ env.ARTIFACTS_APPS_DEFAULT }}/*.zip ${{ vars.FIRMWARE_VERSION }}/ | |
mv -f ${{ env.ARTIFACTS_APPS_EXTRA }}/*.tgz ${{ vars.FIRMWARE_VERSION }}/ | |
mv -f ${{ env.ARTIFACTS_APPS_EXTRA }}/*.zip ${{ vars.FIRMWARE_VERSION }}/ | |
echo "List: ${{ vars.FIRMWARE_VERSION }}" | |
ls -laS ${{ vars.FIRMWARE_VERSION }} | |
- name: "[ALL] Upload production artifacts π¨" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: all-files | |
path: | | |
- ${{ vars.FIRMWARE_VERSION }}/*.tgz | |
- ${{ vars.FIRMWARE_VERSION }}/*.zip | |
- name: "[ALL] Create or update RELEASE ${{ vars.FIRMWARE_VERSION }} with assets π" | |
shell: pwsh | |
env: | |
GITHUB_TOKEN: ${{ secrets.FLIPPER_ZERO_FW }} | |
run: | | |
./.github/create-or-update-release-with-assets.ps1 ${{ vars.FIRMWARE_VERSION }} ${{ vars.FIRMWARE_VERSION }} ${{ github.repository }} ${{ github.ref_name }} |