2022-03-10 15:19:22 +00:00
# version format
version : '{build}'
deploy : on
# branches to build
branches :
# whitelist
only :
- master
# Do not build on tags (GitHub, Bitbucket, GitLab, Gitea)
skip_tags : true
# Maximum number of concurrent jobs for the project
max_jobs : 1
clone_depth : 1
# Build worker image (VM template)
build_cloud : Docker
environment :
APPVEYOR_SSH_KEY : ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBRMxhawMlUlQ8l4pOaeHsZl8XDO54WQngkYM1U/XB4m samsyn\jonatan@JonatanAMD
docker_image : node:16-alpine
npm_config_cache : /appveyor/projects/cache
test_script :
- sh : |
2022-03-10 15:21:56 +00:00
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
chmod -R 777 /appveyor/projects
2022-03-10 15:19:22 +00:00
echo "no tests"
# on successful build
on_success :
- sh : |
apk add curl jq
if [ $? -eq 0 ]; then
echo "Finished installling curl and jq"
else
exit 1
fi
CURR_VER=$(cat package.json | jq -r .version)
echo "Checking https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases for version v${CURR_VER}"
curl -s -X GET -H "Authorization: token $deploytoken" https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases | grep -o "\"name\"\:\"v${CURR_VER}\"" > /dev/null
if [ $? -eq 0 ] ; then
echo "Release already exists, nothing to do.";
else
2022-03-10 15:23:46 +00:00
./7zas a -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api
2022-03-10 15:19:22 +00:00
echo "Creating release on gitea"
RELEASE_RESULT=$(curl \
-X POST \
-H "Authorization: token $deploytoken" \
-H "Content-Type: application/json" \
https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases \
-d "{\"tag_name\":\"v${CURR_VER}\",\"name\":\"v${CURR_VER}\",\"body\":\"Automatic release from Appveyor from ${APPVEYOR_REPO_COMMIT} :\n\n${APPVEYOR_REPO_COMMIT_MESSAGE}\"}")
RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id)
echo "Adding ${CURR_VER}_build-sc.7z to release ${RELEASE_ID}"
curl \
-X POST \
-H "Authorization: token $deploytoken" \
-F "attachment=@${CURR_VER}_build-sc.7z" \
https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases/$RELEASE_ID/assets
fi
# on build failure
on_failure :
- sh : echo on_failure