From 152b9192bc6ffe0f4e349caef3d161f9a6182583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 29 Aug 2023 17:03:53 +0200 Subject: [PATCH] Reuse GitHub workflows --- .github/workflows/build-custom-ap.yml | 80 --------------------------- .github/workflows/push-custom-ap.yml | 45 +++++++++++++++ 2 files changed, 45 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/build-custom-ap.yml create mode 100644 .github/workflows/push-custom-ap.yml diff --git a/.github/workflows/build-custom-ap.yml b/.github/workflows/build-custom-ap.yml deleted file mode 100644 index e09644c..0000000 --- a/.github/workflows/build-custom-ap.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Build CustomAP firmware -on: - workflow_dispatch: - push: - branches: - - master - paths: - - .github/workflows/build-custom-ap.yml - - platformio-custom-ap/** - -jobs: - lint-clang-format: - name: Lint with clang-format - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Check code with clang-format - uses: jidicula/clang-format-action@v4.5.0 - with: - clang-format-version: "14" - - build: - name: Build with PlatformIO - runs-on: ubuntu-latest - needs: lint-clang-format - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Cache pip - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Cache PlatformIO - uses: actions/cache@v2 - with: - path: ~/.platformio - key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - - - name: Set up Python - uses: actions/setup-python@v2 - - - name: Install PlatformIO - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio - - - name: Install LibreTiny platform - run: | - pio platform install -f https://github.com/kuba2k2/libretiny - - - name: Get current build date - id: build - run: echo "::set-output name=date::$(date +'%y.%m.%d')" - - - name: Build with PlatformIO - working-directory: ./platformio-custom-ap/ - run: | - pio run -e bk7231t -e bk7231n -e rtl8710bn -e esp32 -e esp8266 - cp .pio/build/esp32/firmware.bin .pio/build/esp32/platformio-custom-ap_${{ steps.build.outputs.date }}_esp32.bin - cp .pio/build/esp8266/firmware.bin .pio/build/esp8266/platformio-custom-ap_${{ steps.build.outputs.date }}_esp8266.bin - - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - - name: Publish GitHub Release - uses: softprops/action-gh-release@v1 - with: - name: CustomAP release ${{ steps.date.outputs.date }} - files: | - platformio-custom-ap/.pio/build/*/platformio-custom-ap*.uf2 - platformio-custom-ap/.pio/build/*/platformio-custom-ap*.bin - tag_name: v${{ steps.build.outputs.date }} - fail_on_unmatched_files: true diff --git a/.github/workflows/push-custom-ap.yml b/.github/workflows/push-custom-ap.yml new file mode 100644 index 0000000..87b815d --- /dev/null +++ b/.github/workflows/push-custom-ap.yml @@ -0,0 +1,45 @@ +name: Push (CustomAP) +on: + push: + branches: ["master"] + paths: + - .github/workflows/push-custom-ap.yml + - platformio-custom-ap/** + workflow_dispatch: +jobs: + lint-clang: + name: Run Clang lint + uses: kuba2k2/kuba2k2/.github/workflows/lint-clang.yml@master + version: + name: Get version numbers + uses: kuba2k2/kuba2k2/.github/workflows/version.yml@master + build-pio: + name: Build PlatformIO project + needs: + - lint-clang + - version + uses: kuba2k2/kuba2k2/.github/workflows/build-pio.yml@master + with: + project-directory: ./platformio-custom-ap/ + pre-build: | + pio platform install -f https://github.com/kuba2k2/libretiny + post-build: | + mkdir -p dist/ + cp .pio/build/esp32/firmware.bin dist/lightleak-custom-ap_v${{ needs.version.outputs.now-long }}_esp32.bin + cp .pio/build/esp8266/firmware.bin dist/lightleak-custom-ap_v${{ needs.version.outputs.now-long }}_esp8266.bin + cp .pio/build/bk7231t/firmware.uf2 dist/lightleak-custom-ap_v${{ needs.version.outputs.now-long }}_bk7231t.uf2 + cp .pio/build/bk7231n/firmware.uf2 dist/lightleak-custom-ap_v${{ needs.version.outputs.now-long }}_bk7231n.uf2 + cp .pio/build/rtl8710bn/firmware.uf2 dist/lightleak-custom-ap_v${{ needs.version.outputs.now-long }}_rtl8710bn.uf2 + files: | + platformio-custom-ap/dist/*.* + gh-release: + name: Publish GitHub release + needs: + - version + - build-pio + uses: kuba2k2/kuba2k2/.github/workflows/gh-release.yml@master + permissions: + contents: write + with: + artifact: ${{ needs.build-pio.outputs.artifact }} + name: v${{ needs.version.outputs.now-long }}