Export ECAD #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Export ECAD | |
on: | |
workflow_dispatch: | |
release: | |
types: [ published ] | |
jobs: | |
export-ecad: | |
name: Export ECAD | |
runs-on: ubuntu-latest | |
container: ghcr.io/inti-cmnb/kicad8_auto | |
steps: | |
- name: Generate Short SHA Environment Variable | |
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | |
- name: Update system repositories, Install Required Libraries and Initialize git-lfs | |
run: | | |
apt update | |
apt -y install git git-lfs zip librsvg2-bin imagemagick | |
git lfs install | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
lfs: true | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Update the PCBs with on default branch with git hash | |
if: github.event_name == 'release' || steps.extract_branch.outputs.branch == env.main_branch | |
run: | | |
export COMMIT=$(git rev-parse --short HEAD) | |
echo "COMMIT = ${COMMIT}" | |
echo "ref: ${{ github.ref }}" | |
echo "default: ${{ env.default }}" | |
sed -i "s!<<hash>>!${COMMIT}!" pnp/pcb/mobo/mobo.kicad_pcb | |
sed -i "s!<<hash>>!${COMMIT}!" pnp/pcb/ring-light/ringLight.kicad_pcb | |
sed -i "s!<<hash>>!${COMMIT}!" pnp/pcb/staging-plate/staging-plate.kicad_pcb | |
sed -i "s!<<hash>>!${COMMIT}!" pnp/pcb/datum/datum.kicad_pcb | |
sed -i "s!<<hash>>!${COMMIT}!" pnp/pcb/ftp/ftp.kicad_pcb | |
- name: Update the PCBs with the git hash and BETA. | |
if: steps.extract_branch.outputs.branch != env.main_branch | |
run: | | |
export COMMIT=$(git rev-parse --short HEAD) | |
echo "COMMIT = ${COMMIT}" | |
sed -i "s!<<hash>>!BETA-${COMMIT}!" pnp/pcb/mobo/mobo.kicad_pcb | |
sed -i "s!<<hash>>!BETA-${COMMIT}!" pnp/pcb/ring-light/ringLight.kicad_pcb | |
sed -i "s!<<hash>>!BETA-${COMMIT}!" pnp/pcb/staging-plate/staging-plate.kicad_pcb | |
sed -i "s!<<hash>>!BETA-${COMMIT}!" pnp/pcb/datum/datum.kicad_pcb | |
sed -i "s!<<hash>>!BETA-${COMMIT}!" pnp/pcb/ftp/ftp.kicad_pcb | |
#mobo | |
- name: Generate Mobo Export Files | |
run: | | |
cd pnp/pcb/mobo | |
rm -rf mobo/ | |
kibot -c ../../../.github/workflows/scripts/kibot/config-4layer.kibot.yaml -e mobo.kicad_sch -b mobo.kicad_pcb -d mobo | |
zip -r -j mobo.zip mobo/ | |
#ringlight | |
- name: Generate Ring Light Export Files | |
run: | | |
cd pnp/pcb/ring-light | |
rm -rf ringLight/ | |
kibot -c ../../../.github/workflows/scripts/kibot/config-2layer.kibot.yaml -e ringLight.kicad_sch -b ringLight.kicad_pcb -d ringLight | |
zip -r -j ringLight.zip ringLight/ | |
#datum | |
- name: Generate Datum Board Export Files | |
run: | | |
cd pnp/pcb/datum | |
rm -rf datum/ | |
kibot -c ../../../.github/workflows/scripts/kibot/config-2layer.kibot.yaml -e datum.kicad_sch -b datum.kicad_pcb -d datum | |
zip -r -j datum.zip datum/ | |
#staging-plate | |
- name: Generate Staging Plate Export Files | |
run: | | |
cd pnp/pcb/staging-plate | |
rm -rf staging-plate/ | |
kibot -c ../../../.github/workflows/scripts/kibot/config-2layer-nobom.kibot.yaml -e staging-plate.kicad_sch -b staging-plate.kicad_pcb -d staging-plate | |
zip -r -j staging-plate.zip staging-plate/ | |
#ftp | |
- name: Generate FTP Export Files | |
run: | | |
cd pnp/pcb/ftp | |
rm -rf ftp/ | |
kibot -c ../../../.github/workflows/scripts/kibot/config-2layer.kibot.yaml -e ftp.kicad_sch -b ftp.kicad_pcb -d ftp | |
zip -r -j ftp.zip ftp/ | |
# Zip and Upload | |
- name: Zip Mobo Export Files for Artifacts | |
run: | | |
cd pnp/pcb/ | |
zip -r -j LumenPnP-PCBs.zip mobo/mobo.zip ring-light/ringLight.zip datum/datum.zip staging-plate/staging-plate.zip ftp/ftp.zip | |
- name: Zip Mobo Export Files for Release | |
run: | | |
cd pnp/pcb/ | |
zip -r -j LumenPnP-PCBs-${{ github.event.release.tag_name }}.zip mobo/mobo.zip ring-light/ringLight.zip datum/datum.zip staging-plate/staging-plate.zip ftp/ftp.zip | |
- name: Upload Mobo Export Files as Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: LumenPnP-PCBs.zip | |
path: pnp/pcb/LumenPnP-PCBs.zip | |
if-no-files-found: error | |
retention-days: 60 | |
- name: Upload Artifacts to Release | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'release' | |
with: | |
files: | | |
pnp/pcb/LumenPnP-PCBs-${{ github.event.release.tag_name }}.zip |