Skip to content

Commit

Permalink
github action
Browse files Browse the repository at this point in the history
  • Loading branch information
nils authored and nils committed Dec 9, 2023
1 parent f53c39a commit ea4d008
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy new version

# Only deploy when a new tag is pushed
on:
push:
tags:
- "v*.*.*"

# Must match the project() name in CMakeLists.txt
env:
APP_NAME: pico_trigger_uart

# Allow this workflow to write back to the repository
permissions:
contents: write

# Build binary and send to releases
jobs:
build-deploy:
runs-on: ubuntu-latest
name: Build and deploy
steps:

- name: Check out this repository
uses: actions/checkout@v3

- name: Build Docker image
run: docker build -t pico-builder-image .

- name: Create Docker container
run: docker create --name pico-builder-container pico-builder-image

- name: Copy out .uf2 file
run: docker cp pico-builder-container:/project/src/build/${APP_NAME}.uf2 ./${APP_NAME}.uf2

- name: Put environment variable into the env context
run: echo "app_name=$APP_NAME" >> $GITHUB_ENV

- name: Push to release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.app_name }}.uf2
body_path: CHANGELOG.md
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

- First version
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Fetch ubuntu image
FROM ubuntu:22.04

# Install prerequisites
RUN \
apt update && \
apt install -y git python3 && \
apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential

# Install Pico SDK
RUN \
mkdir -p /project/src/ && \
cd /project/ && \
git clone https://github.com/raspberrypi/pico-sdk.git --branch master && \
cd pico-sdk/ && \
git submodule update --init && \
cd /

# Set the Pico SDK environment variable
ENV PICO_SDK_PATH=/project/pico-sdk/

# Copy in our source files
COPY src/* /project/src/

# Build project
RUN \
mkdir -p /project/src/build && \
cd /project/src/build && \
cmake .. && \
make

# Command that will be invoked when the container starts
ENTRYPOINT ["/bin/bash"]
2 changes: 1 addition & 1 deletion CMakeLists.txt → src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_executable(pico_trigger_uart pico_trigger_uart.c)

pico_set_linker_script(pico_trigger_uart ${CMAKE_SOURCE_DIR}/memmap_custom.ld)
pico_set_program_name(pico_trigger_uart "pico_trigger_uart")
pico_set_program_version(pico_trigger_uart "0.1")
pico_set_program_version(pico_trigger_uart "0.0.1")

target_link_libraries(pico_trigger_uart
pico_stdlib pico_multicore pico_stdio_usb pico_flash
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ea4d008

Please sign in to comment.