Skip to content

Commit

Permalink
Merge pull request #403 from julio-matarranz/feat/automatic-prerelease
Browse files Browse the repository at this point in the history
feat : add automatic draft prerelease on dev branch and upgrade build steps
  • Loading branch information
BitMaker-hub authored May 25, 2024
2 parents 684a566 + 6983364 commit 3a4c810
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ on:
push:
branches:
- master
- dev

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
Expand All @@ -22,12 +24,36 @@ 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
if: github.ref == 'refs/heads/dev'
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

0 comments on commit 3a4c810

Please sign in to comment.