Skip to content

Merge pull request #39 from keyboardio/tmp/releng #93

Merge pull request #39 from keyboardio/tmp/releng

Merge pull request #39 from keyboardio/tmp/releng #93

Workflow file for this run

name: Build & Publish
on:
push:
branches:
- '**' # Runs on pushes to any branch
pull_request:
branches:
- '**' # Runs on PRs targeting any branch
env:
LC_ALL: C
EXTRA_VERSION: ${{ github.run_number }}
jobs:
metadata:
runs-on: ubuntu-latest
env:
COMMIT_SHA: ${{ github.sha }}
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
- name: Collect the commit SHAs of the build
run: tools/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:
name: firmwares
path: |
output/
publish:
needs: [ metadata, build ]
runs-on: ubuntu-latest
# Ensure this job only runs on pushes to master branch
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Discover the version tag
id: version
run: echo ::set-output name=tag::$(make version-tag)
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Delete the snapshot release
if: ${{ contains(steps.version.outputs.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
- name: Recreate the snapshot release
if: ${{ contains(steps.version.outputs.tag, 'snapshot') }}
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}
- name: Package up the artifacts
shell: bash
run: tar -C artifacts/firmwares -czvf firmware-files.tar.gz .
- 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