Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and publish uf2 on tag and push #13

Merged
merged 12 commits into from
Oct 10, 2023
63 changes: 63 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy new version

# Only deploy when a new tag is pushed
on: [push, pull_request]

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

# 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: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache register
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
load: true
tags: pico-builder-container:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Build
run: docker run -v ./:/project/src/ pico-builder-container

- name: Copy uf2 file
run: cp ./build2/Telemetrix4RpiPico.uf2 ./

- name: Put environment variable into the env context
run: echo "app_name=$APP_NAME" >> $GITHUB_ENV
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
Telemetrix4RpiPico.uf2

- name: Push to release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: Telemetrix4RpiPico.uf2
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 build.sh /root/
RUN chmod +x /root/build.sh
# Build project
# RUN \
# mkdir -p /project/src/build && \
# cd /project/src/build && \
# cmake .. && \
# make

# Command that will be invoked when the container starts
ENTRYPOINT ["/root/build.sh"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ PC. A complete [User's Guide](https://mryslab.github.io/telemetrix-rpi-pico/) is
install and use both the server and client.

To install the server, follow these [installation instructions](https://mryslab.github.io/telemetrix-rpi-pico/install_pico_server/).

Test push
9 changes: 9 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
cd /project/src/
ls
ls ..
mkdir build2/
ls
cd build2
cmake -DCMAKE_BUILD_TYPE=Release ..
make