Skip to content

Commit

Permalink
Merge pull request #49 from ewowi/release-artifacts
Browse files Browse the repository at this point in the history
Add release
  • Loading branch information
netmindz authored Apr 22, 2024
2 parents 444b0d5 + dad7175 commit 6aadd03
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/pio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-${{ matrix.environment}}-${{ hashFiles('platformio.ini') }}
~/.platformio
key: ${{ runner.os }}-${{ matrix.environment}}
- uses: actions/setup-python@v4
with:
python-version: '3.9'
Expand All @@ -55,14 +55,33 @@ 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
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: 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_branch}}-${{env.git_hash}}.bin
path: .pio/build/${{ matrix.environment }}/firmware.bin
retention-days: 30
path: StarMod-${{ matrix.environment }}-${{env.git_ref}}-${{env.git_hash}}.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
- name: List Artifacts
run: find ./
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
draft: True
files: |
artifact/*.bin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6aadd03

Please sign in to comment.