Skip to content

Update build.yml

Update build.yml #139

Workflow file for this run

name: Build with MCU Expresso
on:
push:
branches: [ develop ]
release:
types: [created]
workflow_dispatch:
jobs:
buildDoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Replace MD tokens
run: |
ESCAPED_REPLACE=$(printf '%s\n' "${{ github.ref }}" | sed -e 's/[\/&]/\\&/g')
find doc/*.md -type f -exec sed -i "s/@TKN_COMMIT_ID@/$ESCAPED_REPLACE/g" {} \;
find doc/*.md -type f -exec sed -i "s/@TKN_VERSION@/${{ github.sha }}/g" {} \;
- name: Show replacement resut
run: cat doc/back.md
- name: Publish PDF Document
uses: RobertK66/actions-document-publish@79b8e666c0f531c297a98eee730d3fdecccde9f3
id: publish-document
with:
sources: 'doc/front.md doc/m*.md doc/back.md'
images_dir: doc/pic
image_import: pic
- name: Upload Document
uses: actions/upload-artifact@v3
id: upload-axf
with:
name: 'Build-${{ env.MY_SWVERSION }}'
path: ${{ steps.publish-document.outputs.pdf }}
if-no-files-found: error
buildJob:
runs-on: ubuntu-latest
strategy:
matrix:
kind: ['obc', 'dev']
include:
- kind: obc
board: BA_CLIMBOBC
- kind: dev
board: BA_OM13085_EM2T
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Generate Build defines
run: |
MY_SWVERSION=$(printf '%.8s' "${{ github.sha }}" )
echo "#define BUILD_SWVERSION \"SW-$MY_SWVERSION\"" >> ClimbObc/src/build.h
echo "#define BA_BOARD ${{ matrix.board }}" >> ClimbObc/src/build.h
echo "MY_SWVERSION=$MY_SWVERSION" >> $GITHUB_ENV
cat ClimbObc/src/build.h
pwd
- name: Build the mcu workspace
uses: RobertK66/actions-build-mcuxpresso@main
id: publish-document
with:
projects: |
ado_chip_175x_6x
ClimbObc
configs: |
ado_chip_175x_6x/TestConfig_2
ClimbObc/Debug
resultpath: ClimbObc/Debug/ClimbObc.axf
- name: rename the axf file
run: |
cp ${{ steps.publish-document.outputs.axf }} ClimbObc${{ env.MY_SWVERSION }}-${{ matrix.kind }}.axf
ls
- name: Upload Binary
uses: actions/upload-artifact@v3
id: upload-axf
with:
name: 'Build-${{ env.MY_SWVERSION }}'
path: ClimbObc${{ env.MY_SWVERSION }}-${{ matrix.kind }}.axf
if-no-files-found: error
releaseJob:
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
needs: [ buildJob, buildDoc ]
steps:
- name: Generate release defines
run: |
MY_SWVERSION=$(printf '%.8s' "${{ github.sha }}" )
echo "MY_SWVERSION=$MY_SWVERSION" >> $GITHUB_ENV
- name: Download all the binaries
uses: actions/download-artifact@v3
with:
name: 'Build-${{ env.MY_SWVERSION }}'
path: ./
- name: show path
run: |
ls
zip archive.zip *.axf
ls
- name: upload reelese assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: archive.zip
asset_name: archive.zip
asset_content_type: application/zip