From 1798c45b829611786a86c576b520899872f0df41 Mon Sep 17 00:00:00 2001 From: Julio MATARRANZ Date: Mon, 13 May 2024 10:14:00 +0200 Subject: [PATCH 1/2] feat : add automatic draft prerelease and upgrade build steps --- .github/workflows/main.yml | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6324f25..91f1c24 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,10 +8,11 @@ on: jobs: build: runs-on: ubuntu-latest - + outputs: + version: ${{ steps.version_step.outputs.version }} steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: path: | ~/.cache/pip @@ -22,12 +23,35 @@ jobs: python-version: '3.9' - name: Install PlatformIO Core run: pip install --upgrade platformio - - name: Build PlatformIO Project run: pio run - - name: Archive artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: builded artifacts + name: builded-binaries-${{ github.sha }} path: .pio/build/*/*.bin + if-no-files-found: error + - name: Get version + id: version_step + run: echo "version=`cat src/version.h | grep CURRENT_VERSION | awk -F\\" '{print $2}'`" >> $GITHUB_OUTPUT + + prerelease: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download binaries + uses: actions/download-artifact@v4 + with: + path: ${{ github.workspace }}/binaries + name: builded-binaries-${{ github.sha }} + - name: Rename binaries + run: find ${{ github.workspace }}/binaries -maxdepth 3 -type f -name "*.bin" -exec sh -c 'cp "$0" "${{ github.workspace }}/binaries/$(basename $(dirname "$0"))_$(basename $0)"' {} \; + - name: Pre-release + uses: softprops/action-gh-release@v2 + with: + name: nerdminer-prerelease-${{ needs.build.outputs.version }} + tag_name: nerdminer-prerelease-${{ needs.build.outputs.version }} + prerelease: true + fail_on_unmatched_files: true + files: ${{ github.workspace }}/binaries/*.bin + From 6983364910123fe943144e50349c67c8b8e105aa Mon Sep 17 00:00:00 2001 From: Julio MATARRANZ Date: Wed, 15 May 2024 20:49:26 +0200 Subject: [PATCH 2/2] feat: add build on dev branch and restrict prerelease to dev branch --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 91f1c24..6a9ce88 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - dev jobs: build: @@ -38,6 +39,7 @@ jobs: prerelease: needs: build runs-on: ubuntu-latest + if: github.ref == 'refs/heads/dev' steps: - name: Download binaries uses: actions/download-artifact@v4