From 52c5ed256140b172b953dca55eaaa3c94bcafd3e Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Thu, 18 Apr 2024 23:48:13 +0100 Subject: [PATCH 01/12] Add release --- .github/workflows/pio.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index ce34e695..b2c280e1 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -37,3 +37,21 @@ jobs: path: .pio/build/esp32dev/firmware.bin retention-days: 30 + release: + name: Create Release + runs-on: ubuntu-latest + needs: [build] + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v2 + with: + name: firmware-release + - name: Create draft release + uses: softprops/action-gh-release@v1 + with: + draft: True + files: | + *.bin + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + \ No newline at end of file From b902f09784297ee4219fbae7ca737c391d8f5995 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 00:05:41 +0100 Subject: [PATCH 02/12] Use default for branch/tag name --- .github/workflows/pio.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index b2c280e1..1dfb5eaf 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -25,15 +25,13 @@ jobs: id: vars run: | git_hash=$(git rev-parse --short "$GITHUB_SHA") - git_branch=${GITHUB_REF#refs/heads/} echo "git_hash=${git_hash}" >> $GITHUB_ENV - echo "git_branch=${git_branch}" >> $GITHUB_ENV - name: Build PlatformIO Project run: pio run - name: 'Upload Artifact' uses: actions/upload-artifact@v3 with: - name: StarMod-esp32-${{env.git_branch}}-${{env.git_hash}}.bin + name: StarMod-esp32-${{env.GITHUB_REF_NAME}}-${{env.git_hash}}.bin path: .pio/build/esp32dev/firmware.bin retention-days: 30 From e03c4078253cea4478f21abc97c8e598b7a4f3f8 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 00:16:59 +0100 Subject: [PATCH 03/12] Define PLATFORMIO_BUILD_CACHE_DIR --- .github/workflows/pio.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index 1c4c6091..a4264c23 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -56,6 +56,7 @@ jobs: run: | git_hash=$(git rev-parse --short "$GITHUB_SHA") echo "git_hash=${git_hash}" >> $GITHUB_ENV + echo "PLATFORMIO_BUILD_CACHE_DIR=$HOME/.platformio/.cache" >> $GITHUB_ENV - name: Build PlatformIO Project run: pio run -e ${{ matrix.environment }} - name: 'Upload Artifact' From 387f3ab9a4d486c3f939338139db21dac75e9ba0 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 00:21:04 +0100 Subject: [PATCH 04/12] Download all --- .github/workflows/pio.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index a4264c23..d15cc471 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -73,8 +73,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/download-artifact@v2 - with: - name: firmware-release - name: Create draft release uses: softprops/action-gh-release@v1 with: From 19a80d0499c5c7f1a3c8626894303f389e4392a0 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 00:27:38 +0100 Subject: [PATCH 05/12] List artifacts --- .github/workflows/pio.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index d15cc471..ed504120 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -73,6 +73,8 @@ jobs: if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/download-artifact@v2 + - name: List Artifacts + run: ls -lh - name: Create draft release uses: softprops/action-gh-release@v1 with: From 3bc2de2269ca3c23e02001eab11d4789a30a10f7 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 00:37:12 +0100 Subject: [PATCH 06/12] Update GITHUB_REF_NAME referencing --- .github/workflows/pio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index ed504120..02cf1f48 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -62,7 +62,7 @@ jobs: - name: 'Upload Artifact' uses: actions/upload-artifact@v3 with: - name: StarMod-${{ matrix.environment }}-${{env.GITHUB_REF_NAME}}-${{env.git_hash}}.bin + name: StarMod-${{ matrix.environment }}-${GITHUB_REF_NAME}-${{env.git_hash}}.bin path: .pio/build/${{ matrix.environment }}/firmware.bin retention-days: 30 From 330d7e182348ef2ce8d365bf1d2930dbe4d4dfcb Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 00:44:07 +0100 Subject: [PATCH 07/12] Swap to git_ref --- .github/workflows/pio.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index 02cf1f48..af690a89 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -56,13 +56,14 @@ jobs: run: | git_hash=$(git rev-parse --short "$GITHUB_SHA") echo "git_hash=${git_hash}" >> $GITHUB_ENV + echo "git_ref=${GITHUB_REF_NAME}" >> $GITHUB_ENV echo "PLATFORMIO_BUILD_CACHE_DIR=$HOME/.platformio/.cache" >> $GITHUB_ENV - name: Build PlatformIO Project run: pio run -e ${{ matrix.environment }} - name: 'Upload Artifact' uses: actions/upload-artifact@v3 with: - name: StarMod-${{ matrix.environment }}-${GITHUB_REF_NAME}-${{env.git_hash}}.bin + name: StarMod-${{ matrix.environment }}-${{env.git_ref}}-${{env.git_hash}}.bin path: .pio/build/${{ matrix.environment }}/firmware.bin retention-days: 30 From 3267f068651dd733ff57fb6d0ba393b2eef74dda Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 00:48:25 +0100 Subject: [PATCH 08/12] Cache all ~/.platformio --- .github/workflows/pio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index af690a89..8aecd6d1 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -44,7 +44,7 @@ jobs: with: path: | ~/.cache/pip - ~/.platformio/.cache + ~/.platformio key: ${{ runner.os }}-${{ matrix.environment}}-${{ hashFiles('platformio.ini') }} - uses: actions/setup-python@v4 with: From 36a87bfa7aa22b650dffad3ecb80e1ae4471d250 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 00:52:36 +0100 Subject: [PATCH 09/12] simple cache key and find --- .github/workflows/pio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index 8aecd6d1..8b661cf2 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -75,7 +75,7 @@ jobs: steps: - uses: actions/download-artifact@v2 - name: List Artifacts - run: ls -lh + run: find ./ - name: Create draft release uses: softprops/action-gh-release@v1 with: From 2bfd9f165cb29a9da132d9e8db287b274097539c Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 01:02:24 +0100 Subject: [PATCH 10/12] Rename bin --- .github/workflows/pio.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index 8b661cf2..fd7ddcba 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -45,7 +45,7 @@ jobs: path: | ~/.cache/pip ~/.platformio - key: ${{ runner.os }}-${{ matrix.environment}}-${{ hashFiles('platformio.ini') }} + key: ${{ runner.os }}-${{ matrix.environment}} - uses: actions/setup-python@v4 with: python-version: '3.9' @@ -60,11 +60,12 @@ jobs: echo "PLATFORMIO_BUILD_CACHE_DIR=$HOME/.platformio/.cache" >> $GITHUB_ENV - name: Build PlatformIO Project run: pio run -e ${{ matrix.environment }} + - name: Rename Bin + run: mv .pio/build/${{ matrix.environment }}/firmware.bin StarMod-${{ matrix.environment }}-${{env.git_ref}}-${{env.git_hash}}.bin - name: 'Upload Artifact' uses: actions/upload-artifact@v3 with: - name: StarMod-${{ matrix.environment }}-${{env.git_ref}}-${{env.git_hash}}.bin - path: .pio/build/${{ matrix.environment }}/firmware.bin + path: StarMod-${{ matrix.environment }}-${{env.git_ref}}-${{env.git_hash}}.bin retention-days: 30 release: From cd40f20474a8760d8fa6602e782f7dab19f8075c Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 01:06:55 +0100 Subject: [PATCH 11/12] Artifacts in in sub directory --- .github/workflows/pio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index fd7ddcba..1c7c030c 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -82,6 +82,6 @@ jobs: with: draft: True files: | - *.bin + artifact/*.bin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From dad7175b158276aa4b0ad980360b0212b64a7584 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Fri, 19 Apr 2024 01:08:52 +0100 Subject: [PATCH 12/12] Artifacts in in sub directory --- .github/workflows/pio.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pio.yml b/.github/workflows/pio.yml index 1c7c030c..f32b0628 100644 --- a/.github/workflows/pio.yml +++ b/.github/workflows/pio.yml @@ -82,6 +82,6 @@ jobs: with: draft: True files: | - artifact/*.bin + artifact/*.bin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file