Skip to content

Commit

Permalink
Add default values
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronBeneteau committed Dec 2, 2024
1 parent 6071325 commit c902925
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,57 @@ on:
inputs:
project:
description: 'Project to build (i.e. Demo/Blink)'
required: false
default: 'Demo/Blink'
platform:
description: 'Platform to build for (i.e. cli, stm32f767)'
required: false
default: 'cli'

env:
DEFAULT_PROJECT: Demo/Blink
DEFAULT_PLATFORM: 'cli'

jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build ${{ github.event.inputs.project }} for ${{ github.event.inputs.platform }}
- name: Set effective project and platform
id: defaults
run: |
echo "Effective project: ${{ github.event.inputs.project || env.DEFAULT_PROJECT }}"
echo "Effective platform: ${{ github.event.inputs.platform || env.DEFAULT_PLATFORM }}"
echo "::set-output name=project::${{ github.event.inputs.project || env.DEFAULT_PROJECT }}"
echo "::set-output name=platform::${{ github.event.inputs.platform || env.DEFAULT_PLATFORM }}"
- name: Build ${{ steps.defaults.outputs.project }} for ${{ steps.defaults.outputs.platform }}
run: |
cd firmware
make PROJECT=${{ github.event.inputs.project }} PLATFORM=${{ github.event.inputs.platform }} build
make PROJECT=${{ steps.defaults.outputs.project }} PLATFORM=${{ steps.defaults.outputs.platform }} build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifact-${{ github.event.inputs.project }}-${{ github.event.inputs.platform }}
path: firmware/build/${{ github.event.inputs.project }}/${{ github.event.inputs.platform }}
name: build-artifact-${{ steps.defaults.outputs.project }}-${{ steps.defaults.outputs.platform }}
path: firmware/build/${{ steps.defaults.outputs.project }}/${{ steps.defaults.outputs.platform }}

deploy:
runs-on: self-hosted
needs: build
environment: deploy
steps:

- name: Sanitize project name
id: sanitize
run: |
run: echo "::set-output name=project_name::${GITHUB_EVENT_INPUTS_PROJECT//\//-}"
sanitized_name="${{ steps.defaults.outputs.project || env.DEFAULT_PROJECT }}"
sanitized_name="${sanitized_name//\//-}"
echo "::set-output name=project_name::$sanitized_name"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: firmware/build/${{ github.event.inputs.project }}/${{ github.event.inputs.platform }}
name: build-artifact-${{ steps.sanitize.outputs.project_name }}-${{ github.event.inputs.platform }}
path: firmware/build/${{ steps.defaults.outputs.project }}-${{ steps.defaults.outputs.platform }}
name: build-artifact-${{ steps.sanitize.outputs.project_name }}-${{ steps.defaults.outputs.platform }}
1 change: 0 additions & 1 deletion .github/workflows/test-self-hosted.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Test Self-Hosted Runner

on:
push:
workflow_dispatch:

jobs:
Expand Down

0 comments on commit c902925

Please sign in to comment.