Skip to content

Merge pull request #5 from redmushie/master #6

Merge pull request #5 from redmushie/master

Merge pull request #5 from redmushie/master #6

Workflow file for this run

on:
push:
tags:
- 'v**'
name: ci-tag
env:
SHOCKLINK_API_URL: api.shocklink.net
SHOCKLINK_FW_VERSION: ${{ github.ref_name }}
jobs:
# Copied verbatim from https://docs.platformio.org/en/stable/integration/ci/github-actions.html
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/platforms
~/.platformio/packages
~/.platformio/cache
key: ${{ runner.os }}-arch
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Build PlatformIO Project
run: pio run
- name: Upload internal artifacts
uses: actions/upload-artifact@v3
with:
name: firmware.bin
path: .pio/build/ShockLink/firmware.bin
retention-days: 1
publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download release notes
uses: actions/checkout@v4
with:
sparse-checkout: |
RELEASE.md
- name: Download internal artifacts
uses: actions/download-artifact@v3
with:
name: firmware.bin
# This step reads a file from repo and use it for body of the release
# This works on any self-hosted runner OS
- name: Read RELEASE.md
id: read_release
shell: bash
run: |
r=$(cat RELEASE.md) # <--- Read release.md (Provide correct path as per your repo)
r="${r//'%'/'%25'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT # <--- Set environment variable
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: firmware.bin
asset_name: ShockLink.bin
tag: ${{ github.ref }}
body: |
${{ steps.read_release.outputs.RELEASE_BODY }}