Skip to content

Commit

Permalink
Update BuildAndRelease.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
fhoedemakers committed Aug 3, 2023
1 parent 691a796 commit e278bc0
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions .github/workflows/BuildAndRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ name: Build and create a release when tag is pushed
# Only deploy when a new tag is pushed
on:
push:
tags:
- "v*.*-alpha"
- "v*.*.*"

# tags:
# - "v*.*-alpha"
# - "v*.*.*"
branches: [ master ]
pull_request:
branches: [ master ]

# Must match the project() name in CMakeLists.txt
env:
APP_NAME: PicoSystem_InfoNes
Expand All @@ -26,28 +29,62 @@ jobs:
run: |
sudo apt update && \
sudo apt install -y git python3 && \
sudo apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential
sudo apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential libusb-1.0-0-dev
- name: Check out this repository
uses: actions/checkout@v3

- name: Print Working directory
run: echo $HOME && pwd && ls -la

- name: Update line containing pico_set_program_version() in CMakelists.txt with tag name.
run: |
# Extract the tag name that triggered the event and remove the 'refs/tags/' prefix
input_string=${{ github.ref }}
input_string="refs/tags/v99.99.99"
prefix="refs/tags/"
tag="No versioninfo found"
if [[ $input_string == $prefix* ]]; then
echo "The string starts with 'refs/tags/'."
tag="${input_string#$prefix}"
echo "Tag is ${tag}"
sed -i "s/^[[:space:]]*pico_set_program_version(.*/pico_set_program_version(${{ env.APP_NAME }} \"$tag\")/" CMakeLists.txt
else
echo "The string does not start with 'refs/tags/'."
fi
grep "pico_set_program_version" CMakeLists.txt
- name: Install Pico SDk
run: |
cd $HOME && \
git clone https://github.com/raspberrypi/pico-sdk.git --branch master && \
cd pico-sdk/ && \
git submodule update --init
- name: Install picotool
run: |
cd $HOME && \
export PICO_SDK_PATH=$HOME/pico-sdk && \
git clone https://github.com/raspberrypi/picotool.git --branch master && \
cd picotool/ && \
mkdir build && \
cd build && \
cmake .. && \
make
- name: Build the project
run: |
export PICO_SDK_PATH=$HOME/pico-sdk && \
mkdir build && cd build && \
cmake .. && \
make
- name: Show release info using picotool
run: |
export PICO_SDK_PATH=$HOME/pico-sdk && \
$HOME/picotool/build/picotool info build/${{ env.APP_NAME }}.uf2 && \
echo "-----------------------------"
- name: download latest release of PicoSystemInfoNesLoader.zip
run: |
ASSET_URL=$(curl -s "https://api.github.com/repos/fhoedemakers/PicoSystemInfoNesLoader/releases/latest" | jq -r '.assets[0].browser_download_url')
Expand Down

0 comments on commit e278bc0

Please sign in to comment.