fix job class #30
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: Release | |
permissions: | |
contents: write | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio-${{ hashFiles('**/*.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pio- | |
- name: Set Up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Adjust INI for Release | |
run: sh .github/scripts/release.sh | |
- name: Build PlatformIO Project | |
run: pio run | |
- name: Archive Artifacts | |
run: | | |
mkdir -p artifacts | |
find .pio/build -name "firmware.bin" -exec sh -c 'cp "{}" "artifacts/firmware_$(basename $(dirname {})).bin"' \; | |
find .pio/build -name "bootloader.bin" -exec sh -c 'cp "{}" "artifacts/bootloader_$(basename $(dirname {})).bin"' \; | |
find .pio/build -name "partitions.bin" -exec sh -c 'cp "{}" "artifacts/partitions_$(basename $(dirname {})).bin"' \; | |
working-directory: ${{ github.workspace }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: builded-artifacts | |
path: artifacts/* | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Extract Version from leafminer.h | |
id: extract_version | |
run: echo "::set-output name=version::$(grep -o '_VERSION "[^"]*' src/leafminer.h | cut -d'"' -f2)" | |
- name: Create GitHub Release | |
run: gh release create v${{ steps.extract_version.outputs.version }} -t "Release ${{ steps.extract_version.outputs.version }}" -n "Release ${{ steps.extract_version.outputs.version }}" -F CHANGELOG.md | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: builded-artifacts | |
path: artifacts | |
- name: Upload Artifacts to Release | |
run: | | |
for file in artifacts/*.bin; do | |
gh release upload v${{ steps.extract_version.outputs.version }} "$file" --clobber; | |
done | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |