Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Add release script for Arduino sample
Browse files Browse the repository at this point in the history
  • Loading branch information
rnestler committed May 15, 2020
1 parent 9dffaaf commit ee66831
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
drivers=sfm3003 sfm3019
sample-projects=sfm3019-arduino
clean_drivers=$(foreach d, $(drivers), clean_$(d))
release_drivers=$(foreach d, $(drivers), release/$(d))
release_sample_projects=$(foreach s, $(sample-projects), release/$(s))
Expand Down Expand Up @@ -39,7 +40,18 @@ $(release_drivers): sfm-common/sfm_git_version.c
cd release && zip -r "$${pkgname}.zip" "$${pkgname}" && cd - && \
ln -sfn $${pkgname} $@

release: clean $(release_drivers)
$(release_sample_projects):
export rel=$@ && \
export sample_project=$${rel#release/} && \
export tag="$$(git describe --always --dirty)" && \
export pkgname="$${sample_project}-sample-project-$${tag}" && \
export pkgdir="release/$${pkgname}" && \
rm -rf "$${pkgdir}" && mkdir -p "$${pkgdir}" && \
sample-projects/$${sample_project}/prepare_release.sh "$${pkgdir}" && \
cd release && zip -r "$${pkgname}.zip" "$${pkgname}" && cd - && \
ln -sfn $${pkgname} release/$${sample_project}

release: clean $(release_drivers) $(release_sample_projects)

$(clean_drivers):
export rel=$@ && \
Expand Down
20 changes: 20 additions & 0 deletions sample-projects/sfm3019-arduino/prepare_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

if [ "$#" -ne 1 ] || ! [ -d "$1" ]; then
echo "Usage: $0 OUTPUT_DIRECTORY" >&2
exit 1
fi

BASE_DIR=$(dirname "$0")

"${BASE_DIR}/copy_sfm3019_driver.sh"

# Copy everything
cp -r "${BASE_DIR}/"* "$1"
# Create documentation
pandoc --variable urlcolor=cyan -s -o "$1"/README.pdf "$1"/RELEASE_DOC.md
# Delete unneeded files
rm "$1"/copy_sfm3019_driver.sh
rm "$1"/prepare_release.sh
rm "$1"/README.md
rm "$1"/RELEASE_DOC.md

0 comments on commit ee66831

Please sign in to comment.