ncp-update: Add support for pr refs

This commit is contained in:
Tobias Knöppler 2022-08-21 13:26:15 +02:00 committed by GitHub
parent 8b4f9cb0b3
commit 1669bdeace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View File

@ -144,12 +144,17 @@ jobs:
- name: Update ncp
run: |
set -ex
VERSION="${VERSION/refs\/heads\//}"
VERSION="${VERSION/refs\/tags\//}"
VERSION="${VERSION/refs\/pull\//}"
BRANCH="${VERSION/refs\/heads\//}"
BRANCH="${VERSION/refs\/tags\//}"
if [[ "$BRANCH" =~ "refs/pull/"* ]]
then
UPDATE_ARGS=("${{ github.base_ref }}" "$VERSION")
else
UPDATE_ARGS=("$BRANCH")
fi
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
echo "Running update ${{ needs.build-previous.outputs.previous_version }} -> ${VERSION}"
lxc exec ncp -- bash -c "DBG=x ncp-update '${VERSION//}'"
lxc exec ncp -- bash -c "DBG=x ncp-update ${UPDATE_ARGS[*]}"
lxc stop ncp
- name: Checkout code
uses: actions/checkout@v3

View File

@ -18,6 +18,13 @@
echo "No internet connectivity"
exit 1
}
[[ -z "$2" ]] || {
git fetch origin "$2" || {
echo "Error: Could not fetch $2"
exit 1
}
git checkout FETCH_HEAD
}
[[ -f /.ncp-image ]] || cd "$TMPDIR" # update locally during build