Append commit hash to version #87
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: [pull_request, push] | |
defaults: | |
run: | |
working-directory: ./ | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set FIRMWARE_VERSION variable | |
run: | | |
FIRMWARE_VER=$(cat VERSION) | |
echo "FIRMWARE_VERSION=$FIRMWARE_VER" >> $GITHUB_ENV | |
- name: Get commit hash | |
id: commit_hash | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install platformio | |
- name: Build | |
run: pio run | |
- name: Rename firmware | |
run: mv .pio/build/rpipicow/firmware.uf2 .pio/build/rpipicow/xrp-wpilib-firmware-${{ env.FIRMWARE_VERSION }}-${{ steps.commit_hash.outputs.sha_short }}.uf2 | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: xrp-wpilib-firmware-${{ env.FIRMWARE_VERSION }}-${{ steps.commit_hash.outputs.sha_short }} | |
path: .pio/build/rpipicow/xrp-wpilib-firmware-*.uf2 |