diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d264e0..6c6d3d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ env: EXTRA_VERSION: ${{ github.run_number }} jobs: - metadata: + build: runs-on: ubuntu-latest env: COMMIT_SHA: ${{ github.sha }} @@ -24,28 +24,12 @@ jobs: path: ${{ github.workspace}}/.arduino/downloads key: ${{ runner.os }}-arduino-downloads - run: make setup + - run: make all KALEIDOSCOPE_TEMP_PATH=${{ github.workspace}}/.kaleidoscope-temp - name: Collect the commit SHAs of the build - run: tools/collect-build-info + run: make collect-build-info - name: Add the NEWS as a changelog to the artifacts run: cp NEWS.md output/firmware-changelog.md - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: firmwares - path: | - output/ - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Cache arduino dep downloads - uses: actions/cache@v3 - with: - path: ${{ github.workspace}}/.arduino/downloads - key: ${{ runner.os }}-arduino-downloads - - run: make setup - - run: make all KALEIDOSCOPE_TEMP_PATH=${{ github.workspace}}/.kaleidoscope-temp - name: Upload artifacts uses: actions/upload-artifact@v3 with: @@ -53,18 +37,19 @@ jobs: path: | output/ - publish: - needs: [ metadata, build ] + publish: [ build ] runs-on: ubuntu-latest # Ensure this job only runs on pushes to master branch if: github.ref == 'refs/heads/master' - + env: + OUTPUT_DIR: artifacts/firmwares steps: - uses: actions/checkout@v3 - - name: Discover the version tag id: version - run: echo ::set-output name=tag::$(make version-tag) + run: | + TAG=$(make version-tag) + echo "TAG=$TAG" >> $GITHUB_ENV - name: Download artifacts uses: actions/download-artifact@v2 @@ -72,49 +57,26 @@ jobs: path: artifacts - name: Delete the snapshot release - if: ${{ contains(steps.version.outputs.tag, 'snapshot') }} + if: ${{ contains(env.tag, 'snapshot') }} env: GITHUB_TOKEN: ${{ secrets.github_token }} - TAG: ${{ steps.version.outputs.tag }} shell: bash run: | - gh release delete -y ${TAG} || true - git tag -d ${TAG} || true - git push origin :${TAG} || true + make delete-tag-and-gh-release - - name: Recreate the snapshot release - if: ${{ contains(steps.version.outputs.tag, 'snapshot') }} + - name: Create the release env: GITHUB_TOKEN: ${{ secrets.github_token }} - TAG: ${{ steps.version.outputs.tag }} run: | - gh release create -p \ - -t "Chrysalis Firmware Bundle $(make version)" \ - -F artifacts/firmwares/release-notes.md \ - ${TAG} - - - name: Create the new release - if: ${{ !contains(steps.version.outputs.tag, 'snapshot') }} - env: - GITHUB_TOKEN: ${{ secrets.github_token }} - TAG: ${{ steps.version.outputs.tag }} - run: | - gh release create \ - -t "Chrysalis Firmware Bundle $(make version)" \ - -F artifacts/firmwares/release-notes.md \ - ${TAG} - + make create-gh-release - name: Package up the artifacts shell: bash - run: tar -C artifacts/firmwares -czvf firmware-files.tar.gz . + run: | + make package-firmware-build - name: Upload the firmware files & build info to the release shell: bash env: GITHUB_TOKEN: ${{ secrets.github_token }} - TAG: ${{ steps.version.outputs.tag }} run: | - gh release upload ${TAG} \ - firmware-files.tar.gz \ - artifacts/firmwares/build-info.yml \ - artifacts/firmwares/firmware-changelog.md + make upload-gh-release diff --git a/Makefile b/Makefile index 791e5dd..f579975 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ update: pull-kaleidoscope: setup (cd ${KALEIDOSCOPE_DIR} && git fetch origin && git pull origin master) - git commit -s -m "Updated Kaleidoscope to origin/master" lib/Kaleidoscope + git commit -s -m "Updated Kaleidoscope to origin/master" lib/Kaleidoscope .env: echo "ARDUINO_DIRECTORIES_USER=\"${ARDUINO_DIRECTORIES_USER}\"" >.env @@ -80,10 +80,33 @@ pull-kaleidoscope: setup create-snapshot: ./tools/release create-snapshot +collect-build-info: + ./tools/collect-build-info + finalize-release: ./tools/release finalize +delete-tag-and-gh-release: + gh release delete -y ${TAG} || true + git tag -d ${TAG} || true + git push origin :${TAG} || true + +create-gh-release: + gh release create -p \ + -t "Chrysalis Firmware Bundle $(make version)" \ + -F ${OUTPUT_DIR}/release-notes.md \ + ${TAG} + +upload-gh-release: + gh release upload ${TAG} \ + firmware-files.tar.gz \ + ${OUTPUT_DIR}/build-info.yml \ + ${OUTPUT_DIR}/firmware-changelog.md + +package-firmware-build: + tar -C ${OUTPUT_DIR} -czvf firmware-files.tar.gz . + .SILENT: .PHONY: ${BOARDS} clean all message version version-tag setup update .env