fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
818d962
gram
1name : Build device config 2 3on : [ workflow_call ] 4 5jobs : 6metadata : 7runs-on : ubuntu-latest 8name : Parse config metadata 9outputs : 10meta_json : ${{ steps.parse_yaml.outputs.metadata }} 11build_matrix : ${{ steps.parse_yaml.outputs.metadata.build }} 12steps : 13- name : Checkout 14uses : actions/checkout@v4 15 16- name : Install yaml2json 17run : python3 -m pip install remarshal 18 19- name : Read metadata from yaml file 20id : parse_yaml 21run : | 22echo "metadata=$(yaml2json 'meta.yaml')" >> "$GITHUB_OUTPUT" 23 24build : 25runs-on : ubuntu-latest 26permissions : 27contents : write 28needs : metadata 29env : 30HAYBOX_REPO : ${{ fromJson(needs.metadata.outputs.meta_json).repo }} 31HAYBOX_REVISION : ${{ fromJson(needs.metadata.outputs.meta_json).revision }} 32DEVICE_CONFIG_REVISION : ${{ github.ref_type == 'tag' && github.ref_name || github.sha }} 33PIO_ENV : ${{ matrix.env }} 34BIN_EXT : ${{ matrix.bin_ext }} 35strategy : 36fail-fast : false 37matrix : 38include : ${{ fromJson(needs.metadata.outputs.meta_json).build }} 39 40steps : 41- name : Check out specific HayBox revision 42run : | 43git clone "https://github.com/$HAYBOX_REPO" . 44git checkout "$HAYBOX_REVISION" 45 46- name : Check out config repo 47uses : actions/checkout@v4 48with : 49path : config/device 50 51- name : Set up Python 52uses : actions/setup-python@v5 53with : 54python-version : '3.10' 55 56- name : Install PlatformIO 57run : | 58python -m pip install --upgrade pip 59pip install --upgrade platformio 60 61- name : Set artifact filename environment variable 62run : | 63echo "ARTIFACT_NAME=HayBox-${HAYBOX_REVISION}-${PIO_ENV}-${DEVICE_CONFIG_REVISION}.${BIN_EXT}" >> "$GITHUB_ENV" 64 65- name : Set artifact path environment variable 66run : | 67echo "ARTIFACT_PATH=${PIO_ENV}/${ARTIFACT_NAME}" >> "$GITHUB_ENV" 68 69- name : Build ${{ matrix.env }} env 70run : | 71pio run -e "$PIO_ENV" 72mkdir -p "$PIO_ENV" 73 74cp ".pio/build/${PIO_ENV}/firmware.${BIN_EXT}" "$ARTIFACT_PATH" 75 76- name : Publish ${{ matrix.env }} artifacts 77uses : actions/upload-artifact@v4 78with : 79name : ${{ env.ARTIFACT_NAME }} 80path : ${{ env.ARTIFACT_PATH }} 81 82- name : Upload binaries to release 83uses : softprops/action-gh-release@v1 84if : github.ref_type == 'tag' 85with : 86files : ${{ env.ARTIFACT_PATH }}