Skip to content

Commit

Permalink
Fix pages build/deploy running on all pushes (#60)
Browse files Browse the repository at this point in the history
fixes #59 and build issues associated with #57
  • Loading branch information
aeroniemi authored May 18, 2024
1 parent aa9743f commit 7cde617
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 39 deletions.
28 changes: 1 addition & 27 deletions .github/workflows/pio-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Cache pip
Expand Down Expand Up @@ -42,29 +41,4 @@ jobs:
with:
name: firmware
path: |
.pio/build/**/*_merged.bin
- run: |
mkdir -p _site/firmware
cp .pio/build/m5knob/firmware_merged.bin _site/firmware/esp32-s3.bin
cp manifest.json _site/firmware/manifest.json
cp static/* _site/
- name: Create GitHub Pages assets
uses: actions/upload-pages-artifact@v3
deploy-pages:
runs-on: ubuntu-latest
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
.pio/build/**/*_merged.bin
44 changes: 32 additions & 12 deletions .github/workflows/pio-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,36 @@ jobs:
key: ${{ runner.os }}-pio-${{ hashFiles('platformio.ini')}}
restore-keys: |
${{ runner.os }}-pio-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
# - name: Extract build version
# id: get_version
# uses: battila7/get-version-action@v2

- name: Run PlatformIO
# env:
# VERSION: ${{ steps.get_version.outputs.version-without-v }}
- name: Build PlatformIO Project
run: pio run

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: firmware
path: |
.pio/build/**/*_merged.bin
- run: |
mkdir -p _site/firmware
cp .pio/build/m5knob/firmware_merged.bin _site/firmware/esp32-s3.bin
cp manifest.json _site/firmware/manifest.json
cp static/* _site/
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: firmware
path: |
.pio/build/**/*_merged.bin
- name: Create GitHub Pages assets
uses: actions/upload-pages-artifact@v3
- name: Release
uses: softprops/action-gh-release@v2
env:
Expand All @@ -63,5 +66,22 @@ jobs:
files: |
.pio/build/**/*_merged.bin
draft: true
deploy-pages:
runs-on: ubuntu-latest
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action


0 comments on commit 7cde617

Please sign in to comment.