Notify when built #5
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: PlatformIO CI | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- 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 firmware | |
uses: actions/upload-artifact@v2 | |
with: | |
name: firmware | |
path: .pio/build/featheresp32/firmware.bin | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install @actions/http-client | |
- name: HTTP Push | |
run: | | |
const http = require('@actions/http-client'); | |
let httpc = new http.HttpClient('github-actions'); | |
(async () => { | |
let res = await httpc.post('http://www.lundvall.info/templog/firmware', JSON.stringify({run_id: process.env.GITHUB_RUN_ID})); | |
if (res.message.statusCode != 200) { | |
throw new Error(`Failed to push: ${res.message.statusMessage}`); | |
} | |
})(); | |
env: | |
GITHUB_RUN_ID: ${{ github.run_id }} |