-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github: add updaterelease workflow and scripts
- Loading branch information
Showing
8 changed files
with
183 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/bin/sh | ||
|
||
git add .github/configs/release/ | ||
set -x | ||
|
||
changed=`git diff HEAD | lsdiff | sed 's/.\///'` | ||
|
||
if [ -z "$changed" ]; then | ||
echo "NO changes" | ||
exit 0 | ||
fi | ||
|
||
echo "Changes: $changed" | ||
|
||
gitdirs=$PWD/.github/git-dirs/ | ||
mkdir -p $gitdirs | ||
|
||
commitmsg=`mktemp -t commitmsg.XXXXXXX` | ||
|
||
echo "" > $commitmsg | ||
|
||
echo_cm(){ | ||
echo "$@" >> $commitmsg | ||
} | ||
|
||
for change in $changed; do | ||
original=$change.orig | ||
git diff HEAD -- $change | patch -f -R -p1 -s -o $original | ||
removed= | ||
if [ -f $change ]; then | ||
repos=`cat $change | yq ".repos | keys()[]"` | ||
else | ||
repos=`cat $original | yq ".repos | keys()[]"` | ||
removed=yes | ||
fi | ||
|
||
change_listed= | ||
|
||
for repo in $repos; do | ||
repourl=null | ||
repocommit=null | ||
if [ -f $change ]; then | ||
repourl=`cat $change | yq ".repos.$repo.url"` | ||
repocommit=`cat $change | yq ".repos.$repo.commit"` | ||
fi | ||
repourlorig=null | ||
repocommitorig=null | ||
if [ -f $original ]; then | ||
repourlorig=`cat $original | yq ".repos.$repo.url"` | ||
repocommitorig=`cat $original | yq ".repos.$repo.commit"` | ||
fi | ||
|
||
if [ -n "$repocommit" -a "$repocommit" = "$repocommitorig" ]; then | ||
echo "$change/$repo: no change" | ||
continue | ||
fi | ||
set -x | ||
if [ -z "$change_listed" ]; then | ||
echo_cm "== $change${removed:+ (REMOVED)}==" | ||
change_listed=yes | ||
echo_cm | ||
fi | ||
echo_cm " $repo:" | ||
echo_cm | ||
|
||
origdir=$PWD | ||
export GIT_DIR=$gitdirs/$repo | ||
|
||
if [ "$repocommitorig" = "null" ]; then | ||
echo_cm " Adding repo $repo from $repourl" | ||
echo_cm " commit $repocommit" | ||
echo_cm | ||
elif [ "$repocommit" = "null" ]; then | ||
echo_cm " Removing repo $repo from $repourlorig" | ||
echo_cm " commit $repocommitorig" | ||
echo_cm | ||
else | ||
gittemp=`mktemp -t -d gittemp.XXXXXX` | ||
echo_cm " Changed repo $repourlorig => $repourl" | ||
echo_cm " commit $repocommitorig => $repocommit" | ||
cd $gittemp | ||
git init | ||
git remote remove current | ||
git remote remove orig | ||
git remote add current $repourl | ||
git remote add orig $repourlorig | ||
git fetch --all -v | ||
git log --oneline $repocommitorig..$repocommit | sed 's/^/ * /' >> $commitmsg | ||
echo_cm | ||
cd $origdir | ||
rm -rf $gittemp | ||
fi | ||
unset GIT_DIR | ||
done | ||
done | ||
|
||
echo "Commit msg:" | ||
cat $commitmsg | ||
set -x | ||
pwd | ||
git diff | ||
git commit -a -F $commitmsg | ||
rm -f $commitmsg | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
|
||
targetdir=$1 | ||
|
||
m=`ls kas/machines/*` | ||
configsuffix=:.github/configs/build-base-remix.yaml:.github/configs/shared-vols.yaml | ||
|
||
configs=" \ | ||
kas/machines/sunxi-orange-pi-3lts.yaml:kas/bsp-base.yaml:kas/scarthgap.yaml$configsuffix \ | ||
kas/machines/sunxi-orange-pi-r1.yaml:kas/bsp-base.yaml:kas/scarthgap.yaml$configsuffix \ | ||
kas/machines/sunxi-nanopi-r1.yaml:kas/bsp-base.yaml:kas/scarthgap.yaml$configsuffix \ | ||
kas/machines/imx8qxpc0mek.yaml:kas/bsp-base.yaml:kas/scarthgap.yaml:kas/scarthgap-nxp.yaml$configsuffix \ | ||
kas/machines/raspberrypi-armv8.yaml:kas/bsp-base.yaml:kas/scarthgap.yaml$configsuffix \ | ||
" | ||
|
||
echo "Processing configs: | ||
$configs" | ||
|
||
rm -f .github/configs/release/*-scarthgap.yaml | ||
|
||
for cc in $configs; do | ||
echo CC: $cc | ||
m=`echo $cc | sed 's/.*machines.//;s/.yaml:.*//'` | ||
KAS_WORK_DIR=. kas dump --resolve-refs "kas/sourcedir.yaml:$sourceyaml:$cc" > .github/configs/release/$m-scarthgap.yaml | ||
echo "new config for machine: $m" | ||
cat .github/configs/release/$m-scarthgap.yaml | ||
done | ||
|
||
git add .github/configs/release/ | ||
|
||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: Do things every 4 hours | ||
on: | ||
schedule: | ||
- cron: "1 */4 * * *" | ||
|
||
jobs: | ||
update-release-machines: | ||
uses: ./.github/workflows/updaterelease.yaml | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: 'Update Release Machines' | ||
|
||
on: | ||
workflow_call: | ||
|
||
push: | ||
paths: | ||
- .github/scripts/** | ||
- .github/workflows/updaterelease.yaml | ||
|
||
jobs: | ||
updaterelease: | ||
runs-on: ["self-hosted"] | ||
container: | ||
image: ghcr.io/pantacor/kas/kas:next-v3 | ||
volumes: | ||
- shared:/shared | ||
options: --user root | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: ls .github/scripts | ||
- run: pwd | ||
- run: .github/scripts/makemachines | ||
- run: git config --global user.email "[email protected]" | ||
- run: git config --global user.name "Pantavisor Meta Layer CI" | ||
- run: .github/scripts/makecommit | ||
- run: git push | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ header: | |
|
||
target: pantavisor-bsp | ||
build_system: oe | ||
_source_dir: . | ||
repos: | ||
meta-pantavisor: | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
header: | ||
version: 16 | ||
|
||
_source_dir: . | ||
|