This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
Merge pull request #18 from raisedevs/archive #92
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: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check if version needs incremented | |
if: github.event_name != 'release' | |
run: | | |
set -xe | |
LAST_TAG="$(gh release list --limit 1 | awk '{print $1}')" | |
if [[ "$(cat VERSION)" == "${LAST_TAG}" ]]; then | |
echo "::error file=VERSION,line=1,col=1,endColumn=5::Version must be incremented!" | |
exit 1 | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: version | |
name: Check and set version outputs | |
run: | | |
set -xe | |
VERSION="$(cat VERSION)" | |
if ! grep '"version": "'"${VERSION}"'",$' library.json; then | |
echo "::error file=library.json,line=3,col=20,endColumn=24::Version must match ${VERSION}!" | |
FAILED=1 | |
fi | |
if ! grep "^version=${VERSION}" library.properties; then | |
echo "::error file=library.properties,line=2,col=14,endColumn=19::Version must match ${VERSION}!" | |
FAILED=1 | |
fi | |
if [[ -n "${FAILED}" ]]; then | |
exit 1 | |
fi | |
echo "filename=RaiseDev-${VERSION}.tar.gz" >> "$GITHUB_OUTPUT" | |
- uses: arduino/arduino-lint-action@v1 | |
with: | |
compliance: strict | |
library-manager: update | |
- 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 | |
run: pip install --upgrade platformio | |
- name: Build RaiseDev library | |
run: pio ci --project-conf=platformio.ini --lib=. examples/Basic | |
- name: Package RaiseDev PlatformIO library | |
run: pio pkg pack --output="${{ steps.version.outputs.filename }}" | |
- name: Publish RaiseDev PlatformIO library | |
run: pio pkg publish --no-interactive --owner=raisedevs --type=library "${{ steps.version.outputs.filename }}" | |
if: github.event_name == 'release' && github.event.action == 'published' | |
env: | |
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} |