This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
Update application source code from nRF Connect SDK #1193
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: Update application source code from nRF Connect SDK | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
push: | |
paths: | |
- ".github/workflows/update-from-ncs.yaml" | |
workflow_dispatch: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} | |
jobs: | |
update: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Remove upstream files | |
run: rm -rf ./{src,boards,child_image,tests} | |
- name: Update from upstream | |
run: | | |
git clone --single-branch --branch v2.5-branch --depth 1 https://github.com/nrfconnect/sdk-nrf sdk-nrf | |
cp -rv sdk-nrf/applications/asset_tracker_v2/* ./ | |
echo "UPSTREAM_REV=`git -C sdk-nrf rev-parse HEAD | tr -d '\n'`" >> $GITHUB_ENV | |
rm -rf sdk-nrf | |
- name: Check if changes were made | |
run: | | |
git status | |
if [[ `git status --porcelain` ]]; then | |
echo "HAS_CHANGES=1" >> $GITHUB_ENV | |
else | |
echo "HAS_CHANGES=0" >> $GITHUB_ENV | |
fi | |
- name: Commit update | |
if: env.HAS_CHANGES == '1' | |
run: | | |
echo "machine github.com login accesskey password ${GITHUB_TOKEN}" > ~/.netrc | |
git config --global user.email "[email protected]" | |
git config --global user.name "github-actions[bot]" | |
git add -A | |
git commit -m "fix: update from upstream | |
See https://github.com/nrfconnect/sdk-nrf/tree/${{ env.UPSTREAM_REV }}/applications/asset_tracker_v2" | |
git pull --rebase | |
git push | |
- name: Trigger build | |
if: env.HAS_CHANGES == '1' | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.CI_GITHUB_TOKEN }} | |
event-type: source-update |