diff --git a/.github/workflows/amap_analyse.yml b/.github/workflows/amap_analyse.yml index 5efdb09e..36352978 100644 --- a/.github/workflows/amap_analyse.yml +++ b/.github/workflows/amap_analyse.yml @@ -35,8 +35,7 @@ jobs: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then - git submodule status \ - || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - name: 'Checkout code' @@ -45,44 +44,14 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - name: 'Escape pull request title' - if: github.event_name == 'pull_request' + - name: 'Get commit details' run: | - import json - import os - import shlex - with open('${{ github.event_path }}') as fh: - event = json.load(fh) - escaped = shlex.quote(event['pull_request']['title']) - with open(os.environ['GITHUB_ENV'], 'a') as fh: - print(f'PULL_NAME={escaped}', file=fh) - shell: python3 {0} - - - name: 'Generate prefixes by commit' - id: names - run: | - REF="${{github.ref}}" - COMMIT_HASH="$(git rev-parse HEAD)" - SHA="$(git rev-parse --short HEAD)" - COMMIT_MSG="${{github.event.head_commit.message}}" + FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh if [[ ${{ github.event_name }} == 'pull_request' ]]; then - REF="${{github.head_ref}}" - COMMIT_HASH="$(git log -1 --pretty=oneline | awk '{print $1}')" - SHA="$(cut -c -8 <<< "$COMMIT_HASH")" - COMMIT_MSG="$(git log -1 --pretty=format:"%s")" - PULL_ID="${{github.event.pull_request.number}}" + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--is_pull" + else + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" fi - BRANCH_NAME=${REF#refs/*/} - SUFFIX=${BRANCH_NAME//\//_}-$(date +'%d%m%Y')-${SHA} - if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then - SUFFIX=${BRANCH_NAME//\//_} - fi - echo "::set-output name=commit-hash::${COMMIT_HASH}" - echo "::set-output name=commit-msg::${COMMIT_MSG}" - echo "::set-output name=pull-id::${PULL_ID}" - echo "::set-output name=pull-name::${PULL_NAME}" - echo "::set-output name=branch-name::${BRANCH_NAME}" - echo "::set-output name=suffix::${SUFFIX}" - name: 'Make artifacts directory' run: | @@ -95,13 +64,13 @@ jobs: chmod 600 ./deploy_key; rsync -avzP \ -e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \ - ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${{steps.names.outputs.branch-name}}/" artifacts/; + ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/" artifacts/; rm ./deploy_key; - name: 'Make .map file analyze' run: | cd artifacts/ - /Applications/amap/Contents/MacOS/amap -f flipper-z-f7-firmware-${{steps.names.outputs.suffix}}.elf.map + /Applications/amap/Contents/MacOS/amap -f "flipper-z-f7-firmware-${SUFFIX}.elf.map" - name: 'Upload report to DB' run: | @@ -110,20 +79,14 @@ jobs: { SECTION="$1"; arm-none-eabi-size \ - -A artifacts/flipper-z-f7-firmware-${{steps.names.outputs.suffix}}.elf \ + -A artifacts/flipper-z-f7-firmware-$SUFFIX.elf \ | grep "^$SECTION" | awk '{print $2}' } - export COMMIT_HASH="${{steps.names.outputs.commit-hash}}" - export COMMIT_MSG="${{steps.names.outputs.commit-msg}}" - export BRANCH_NAME="${{steps.names.outputs.branch-name}}" export BSS_SIZE="$(get_size ".bss")" export TEXT_SIZE="$(get_size ".text")" export RODATA_SIZE="$(get_size ".rodata")" export DATA_SIZE="$(get_size ".data")" export FREE_FLASH_SIZE="$(get_size ".free_flash")" - if [[ ${{ github.event_name }} == 'pull_request' ]]; then - export PULL_ID="${{steps.names.outputs.pull-id}}" - fi python3 -m pip install mariadb python3 scripts/amap_mariadb_insert.py \ ${{ secrets.AMAP_MARIADB_USER }} \ @@ -131,4 +94,4 @@ jobs: ${{ secrets.AMAP_MARIADB_HOST }} \ ${{ secrets.AMAP_MARIADB_PORT }} \ ${{ secrets.AMAP_MARIADB_DATABASE }} \ - artifacts/flipper-z-f7-firmware-${{steps.names.outputs.suffix}}.elf.map.all + artifacts/flipper-z-f7-firmware-$SUFFIX.elf.map.all diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3fe733ca..530bbc9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,10 +19,8 @@ jobs: steps: - name: 'Decontaminate previous build leftovers' run: | - if [ -d .git ] - then - git submodule status \ - || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + if [ -d .git ]; then + git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - name: 'Checkout code' @@ -33,51 +31,44 @@ jobs: - name: 'Make artifacts directory' run: | - test -d artifacts && rm -rf artifacts || true + rm -rf artifacts mkdir artifacts - - name: 'Generate suffix and folder name' + - name: 'Get commit details' + run: | + FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh + if [[ ${{ github.event_name }} == 'pull_request' ]]; then + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--is_pull" + else + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" + fi + + - name: 'Generate suffixes for comment' id: names run: | - REF=${{ github.ref }} - if [[ ${{ github.event_name }} == 'pull_request' ]]; then - REF=${{ github.head_ref }} - fi - BRANCH_OR_TAG=${REF#refs/*/} - SHA=$(git rev-parse --short HEAD) - - if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then - SUFFIX=${BRANCH_OR_TAG//\//_} - else - SUFFIX=${BRANCH_OR_TAG//\//_}-$(date +'%d%m%Y')-${SHA} - fi - - echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV - echo "DIST_SUFFIX=${SUFFIX}" >> $GITHUB_ENV - echo "::set-output name=artifacts-path::${BRANCH_OR_TAG}" + echo "::set-output name=branch_name::${BRANCH_NAME}" + echo "::set-output name=commit_sha::${COMMIT_SHA}" + echo "::set-output name=default_target::${DEFAULT_TARGET}" echo "::set-output name=suffix::${SUFFIX}" - echo "::set-output name=short-hash::${SHA}" - echo "::set-output name=default-target::${DEFAULT_TARGET}" - name: 'Bundle scripts' if: ${{ !github.event.pull_request.head.repo.fork }} run: | - tar czpf artifacts/flipper-z-any-scripts-${{steps.names.outputs.suffix}}.tgz scripts + tar czpf artifacts/flipper-z-any-scripts-${SUFFIX}.tgz scripts - name: 'Build the firmware' run: | set -e - for TARGET in ${TARGETS} - do - FBT_TOOLCHAIN_PATH=/opt ./fbt TARGET_HW=`echo ${TARGET} | sed 's/f//'` updater_package ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }} + for TARGET in ${TARGETS}; do + FBT_TOOLCHAIN_PATH=/opt ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \ + updater_package ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }} done - name: 'Move upload files' if: ${{ !github.event.pull_request.head.repo.fork }} run: | set -e - for TARGET in ${TARGETS} - do + for TARGET in ${TARGETS}; do mv dist/${TARGET}-*/* artifacts/ done @@ -85,12 +76,11 @@ jobs: if: ${{ !github.event.pull_request.head.repo.fork }} run: | set -e - for UPDATEBUNDLE in artifacts/*/ - do - BUNDLE_NAME=`echo $UPDATEBUNDLE | cut -d'/' -f2` - echo Packaging ${BUNDLE_NAME} - tar czpf artifacts/flipper-z-${BUNDLE_NAME}.tgz -C artifacts ${BUNDLE_NAME} - rm -rf artifacts/${BUNDLE_NAME} + for UPDATEBUNDLE in artifacts/*/; do + BUNDLE_NAME="$(echo "$UPDATEBUNDLE" | cut -d'/' -f2)" + echo Packaging "${BUNDLE_NAME}" + tar czpf "artifacts/flipper-z-${BUNDLE_NAME}.tgz" -C artifacts "${BUNDLE_NAME}" + rm -rf "artifacts/${BUNDLE_NAME}" done - name: "Check for uncommitted changes" @@ -100,17 +90,17 @@ jobs: - name: 'Bundle resources' if: ${{ !github.event.pull_request.head.repo.fork }} run: | - tar czpf artifacts/flipper-z-any-resources-${{steps.names.outputs.suffix}}.tgz -C assets resources + tar czpf "artifacts/flipper-z-any-resources-${SUFFIX}.tgz" -C assets resources - name: 'Bundle core2 firmware' if: ${{ !github.event.pull_request.head.repo.fork }} run: | FBT_TOOLCHAIN_PATH=/opt ./fbt copro_dist - tar czpf artifacts/flipper-z-any-core2_firmware-${{steps.names.outputs.suffix}}.tgz -C assets core2_firmware + tar czpf "artifacts/flipper-z-any-core2_firmware-${SUFFIX}.tgz" -C assets core2_firmware - name: 'Copy .map file' run: | - cp build/f7-firmware-*/firmware.elf.map artifacts/flipper-z-f7-firmware-${{steps.names.outputs.suffix}}.elf.map + cp build/f7-firmware-*/firmware.elf.map "artifacts/flipper-z-f7-firmware-${SUFFIX}.elf.map" - name: 'Upload artifacts to update server' if: ${{ !github.event.pull_request.head.repo.fork }} @@ -119,7 +109,7 @@ jobs: chmod 600 ./deploy_key; rsync -avzP --delete --mkpath \ -e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \ - artifacts/ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${{steps.names.outputs.artifacts-path}}/"; + artifacts/ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/"; rm ./deploy_key; - name: 'Trigger update server reindex' @@ -142,10 +132,10 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - **Compiled firmware for commit `${{steps.names.outputs.short-hash}}`:** - - [📦 Update package](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-update-${{steps.names.outputs.suffix}}.tgz) - - [📥 DFU file](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-full-${{steps.names.outputs.suffix}}.dfu) - - [☁️ Web updater](https://my.flipp.dev/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.artifacts-path}}&version=${{steps.names.outputs.short-hash}}) + **Compiled firmware for commit `${{steps.names.outputs.commit_sha}}`:** + - [📦 Update package](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz) + - [📥 DFU file](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-full-${{steps.names.outputs.suffix}}.dfu) + - [☁️ Web updater](https://my.flipp.dev/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.branch_name}}&version=${{steps.names.outputs.commit_sha}}) edit-mode: replace compact: @@ -157,7 +147,7 @@ jobs: if [ -d .git ] then git submodule status \ - || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - name: 'Checkout code' @@ -167,29 +157,21 @@ jobs: submodules: true ref: ${{ github.event.pull_request.head.sha }} - - name: 'Generate suffix and folder name' - id: names + - name: 'Get commit details' run: | - REF=${{ github.ref }} + FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh if [[ ${{ github.event_name }} == 'pull_request' ]]; then - REF=${{ github.head_ref }} - fi - BRANCH_OR_TAG=${REF#refs/*/} - SHA=$(git rev-parse --short HEAD) - - if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then - SUFFIX=${BRANCH_OR_TAG//\//_} + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--is_pull" else - SUFFIX=${BRANCH_OR_TAG//\//_}-$(date +'%d%m%Y')-${SHA} + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" fi - - echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV + echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_NAME}" >> $GITHUB_ENV echo "DIST_SUFFIX=${SUFFIX}" >> $GITHUB_ENV - name: 'Build the firmware' run: | set -e - for TARGET in ${TARGETS} - do - FBT_TOOLCHAIN_PATH=/opt ./fbt TARGET_HW=`echo ${TARGET} | sed 's/f//'` updater_package DEBUG=0 COMPACT=1 + for TARGET in ${TARGETS}; do + FBT_TOOLCHAIN_PATH=/opt ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \ + updater_package DEBUG=0 COMPACT=1 done diff --git a/.github/workflows/check_submodules.yml b/.github/workflows/check_submodules.yml index e021c969..e4178c3c 100644 --- a/.github/workflows/check_submodules.yml +++ b/.github/workflows/check_submodules.yml @@ -15,10 +15,8 @@ jobs: steps: - name: 'Decontaminate previous build leftovers' run: | - if [ -d .git ] - then - git submodule status \ - || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + if [ -d .git ]; then + git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - name: 'Checkout code' diff --git a/.github/workflows/lint_c.yml b/.github/workflows/lint_c.yml index 64d14b71..becafcab 100644 --- a/.github/workflows/lint_c.yml +++ b/.github/workflows/lint_c.yml @@ -18,10 +18,8 @@ jobs: steps: - name: 'Decontaminate previous build leftovers' run: | - if [ -d .git ] - then - git submodule status \ - || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + if [ -d .git ]; then + git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - name: 'Checkout code' diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 5051c569..d5ff834e 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -15,10 +15,8 @@ jobs: steps: - name: 'Decontaminate previous build leftovers' run: | - if [ -d .git ] - then - git submodule status \ - || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + if [ -d .git ]; then + git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - name: 'Checkout code' diff --git a/.github/workflows/pvs_studio.yml b/.github/workflows/pvs_studio.yml index 5733fd27..8ace58b6 100644 --- a/.github/workflows/pvs_studio.yml +++ b/.github/workflows/pvs_studio.yml @@ -20,10 +20,8 @@ jobs: steps: - name: 'Decontaminate previous build leftovers' run: | - if [ -d .git ] - then - git submodule status \ - || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1` + if [ -d .git ]; then + git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - name: 'Checkout code' @@ -32,28 +30,23 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - name: 'Generate suffix and folder name' + - name: 'Get commit details' + run: | + FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh + if [[ ${{ github.event_name }} == 'pull_request' ]]; then + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--is_pull" + else + python3 scripts/get_env.py "--event_file=${{ github.event_path }}" + fi + + - name: 'Generate suffixes for comment' + if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request }} id: names run: | - REF=${{ github.ref }} - if [[ ${{ github.event_name }} == 'pull_request' ]]; then - REF=${{ github.head_ref }} - fi - BRANCH_OR_TAG=${REF#refs/*/} - SHA=$(git rev-parse --short HEAD) - - if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then - SUFFIX=${BRANCH_OR_TAG//\//_} - else - SUFFIX=${BRANCH_OR_TAG//\//_}-$(date +'%d%m%Y')-${SHA} - fi - - echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV - echo "DIST_SUFFIX=${SUFFIX}" >> $GITHUB_ENV - echo "::set-output name=artifacts-path::${BRANCH_OR_TAG}" + echo "::set-output name=branch_name::${BRANCH_NAME}" + echo "::set-output name=commit_sha::${COMMIT_SHA}" + echo "::set-output name=default_target::${DEFAULT_TARGET}" echo "::set-output name=suffix::${SUFFIX}" - echo "::set-output name=short-hash::${SHA}" - echo "::set-output name=default-target::${DEFAULT_TARGET}" - name: 'Make reports directory' run: | @@ -75,7 +68,7 @@ jobs: -o PVS-Studio.log - name: 'Convert PVS-Studio output to html page' - run: plog-converter -a GA:1,2,3 -t fullhtml PVS-Studio.log -o reports/${{steps.names.outputs.default-target}}-${{steps.names.outputs.suffix}} + run: plog-converter -a GA:1,2,3 -t fullhtml PVS-Studio.log -o reports/${DEFAULT_TARGET}-${SUFFIX} - name: 'Upload artifacts to update server' if: ${{ !github.event.pull_request.head.repo.fork }} @@ -84,7 +77,7 @@ jobs: chmod 600 ./deploy_key; rsync -avrzP --mkpath \ -e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \ - reports/ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:/home/data/firmware-pvs-studio-report/"${{steps.names.outputs.artifacts-path}}/"; + reports/ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:/home/data/firmware-pvs-studio-report/"${BRANCH_NAME}/"; rm ./deploy_key; - name: 'Find Previous Comment' @@ -103,6 +96,6 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - **PVS-Studio report for commit `${{steps.names.outputs.short-hash}}`:** - - [Report](https://update.flipperzero.one/builds/firmware-pvs-studio-report/${{steps.names.outputs.artifacts-path}}/${{steps.names.outputs.default-target}}-${{steps.names.outputs.suffix}}/index.html) + **PVS-Studio report for commit `${{steps.names.outputs.commit_sha}}`:** + - [Report](https://update.flipperzero.one/builds/firmware-pvs-studio-report/${{steps.names.outputs.branch_name}}/${{steps.names.outputs.default_target}}-${{steps.names.outputs.suffix}}/index.html) edit-mode: replace diff --git a/scripts/get_env.py b/scripts/get_env.py new file mode 100644 index 00000000..e503803e --- /dev/null +++ b/scripts/get_env.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 + +import ssl +import json +import os +import shlex +import re +import argparse +import datetime +import urllib.request + +# event_file = open('${{ github.event_path }}') + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument("--event_file", help="Current GitHub event file", required=True) + parser.add_argument( + "--is_pull", help="Is it Pull Request", default=False, action="store_true" + ) + args = parser.parse_args() + return args + + +def get_commit_json(event): + context = ssl._create_unverified_context() + with urllib.request.urlopen( + event["pull_request"]["_links"]["commits"]["href"], context=context + ) as commit_file: + commit_json = json.loads(commit_file.read().decode("utf-8")) + return commit_json + + +def get_details(event, args): + data = {} + current_time = datetime.datetime.utcnow().date() + if args.is_pull: + commit_json = get_commit_json(event) + data["commit_comment"] = shlex.quote(commit_json[-1]["commit"]["message"]) + data["commit_hash"] = commit_json[-1]["sha"] + ref = event["pull_request"]["head"]["ref"] + data["pull_id"] = event["pull_request"]["number"] + data["pull_name"] = shlex.quote(event["pull_request"]["title"]) + else: + data["commit_comment"] = shlex.quote(event["commits"][-1]["message"]) + data["commit_hash"] = event["commits"][-1]["id"] + ref = event["ref"] + data["commit_sha"] = data["commit_hash"][:8] + data["branch_name"] = re.sub("refs/\w+/", "", ref) + data["suffix"] = ( + data["branch_name"].replace("/", "_") + + "-" + + current_time.strftime("%d%m%Y") + + "-" + + data["commit_sha"] + ) + if ref.startswith("refs/tags/"): + data["suffix"] = data["branch_name"].replace("/", "_") + return data + + +def add_envs(data, env_file, args): + print(f'COMMIT_MSG={data["commit_comment"]}', file=env_file) + print(f'COMMIT_HASH={data["commit_hash"]}', file=env_file) + print(f'COMMIT_SHA={data["commit_sha"]}', file=env_file) + print(f'SUFFIX={data["suffix"]}', file=env_file) + print(f'BRANCH_NAME={data["branch_name"]}', file=env_file) + print(f'DIST_SUFFIX={data["suffix"]}', file=env_file) + print(f'WORKFLOW_BRANCH_OR_TAG={data["branch_name"]}', file=env_file) + if args.is_pull: + print(f'PULL_ID={data["pull_id"]}', file=env_file) + print(f'PULL_NAME={data["pull_name"]}', file=env_file) + + +def main(): + args = parse_args() + event_file = open(args.event_file) + event = json.load(event_file) + env_file = open(os.environ["GITHUB_ENV"], "a") + data = get_details(event, args) + add_envs(data, env_file, args) + event_file.close() + env_file.close() + + +if __name__ == "__main__": + main() diff --git a/scripts/toolchain/fbtenv.cmd b/scripts/toolchain/fbtenv.cmd index f955a4db..cf5d2441 100644 --- a/scripts/toolchain/fbtenv.cmd +++ b/scripts/toolchain/fbtenv.cmd @@ -13,7 +13,7 @@ if not [%FBT_NOENV%] == [] ( exit /b 0 ) -set "FLIPPER_TOOLCHAIN_VERSION=9" +set "FLIPPER_TOOLCHAIN_VERSION=12" set "FBT_TOOLCHAIN_ROOT=%FBT_ROOT%\toolchain\i686-windows" diff --git a/scripts/toolchain/fbtenv.sh b/scripts/toolchain/fbtenv.sh index cbbb7b94..1c56c03c 100755 --- a/scripts/toolchain/fbtenv.sh +++ b/scripts/toolchain/fbtenv.sh @@ -5,7 +5,7 @@ # public variables DEFAULT_SCRIPT_PATH="$(pwd -P)"; SCRIPT_PATH="${SCRIPT_PATH:-$DEFAULT_SCRIPT_PATH}"; -FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"8"}"; +FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"12"}"; FBT_TOOLCHAIN_PATH="${FBT_TOOLCHAIN_PATH:-$SCRIPT_PATH}"; fbtenv_show_usage()