Set version number using Actions (#68) #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Release | |
on: | |
push: | |
tags: | |
"v*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache PlatformIO | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio | |
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: Build PlatformIO Project | |
env: | |
VERSION: ${{ github.ref_name }} | |
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: Create GitHub Pages assets | |
uses: actions/upload-pages-artifact@v3 | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
generate_release_notes: true | |
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 | |