2022-01-11 16:51:15 +00:00
# version format
version : '{build}'
2022-02-18 06:43:35 +00:00
deploy : on
2022-01-11 16:51:15 +00:00
# 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 :
2022-02-16 12:16:38 +00:00
APPVEYOR_SSH_KEY : ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBRMxhawMlUlQ8l4pOaeHsZl8XDO54WQngkYM1U/XB4m samsyn\jonatan@JonatanAMD
2022-01-11 16:51:15 +00:00
docker_image : node:16-alpine
npm_config_cache : /appveyor/projects/cache
test_script :
- sh : |
2022-02-18 06:24:52 +00:00
mkdir /lib64
2022-02-16 11:49:48 +00:00
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
2022-01-27 18:32:43 +00:00
chmod -R 777 /appveyor/projects
2022-01-11 16:51:15 +00:00
npm install
npm test
2022-02-15 16:32:43 +00:00
npm run test:integration
2022-02-18 06:43:35 +00:00
artifacts :
- path : ./*_sc-core.7z
# on successful build
on_success :
2022-02-18 06:46:32 +00:00
- sh : |
2022-02-18 07:40:39 +00:00
apk add curl jq
CURR_VER=$(cat package.json | jq -r .version)
if 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; then
2022-02-18 06:46:32 +00:00
echo "Release already exists, nothing to do.";
else
./test/7zas a -mx9 "${CURR_VER}_sc-core.7z" package.json index.mjs cli.mjs core bin
2022-02-18 07:40:39 +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}: ${APPVEYOR_REPO_COMMIT_MESSAGE}\"}")
RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id)
echo "Adding ${CURR_VER}_sc-core.7z to release ${RELEASE_ID}"
curl \
-X POST \
-H "Authorization: token $deploytoken" \
-F "attachment=@${CURR_VER}_sc-core.7z" \
https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases/$RELEASE_ID/assets
2022-02-18 06:50:14 +00:00
echo '//registry.npmjs.org/:_authToken=${npmtoken}' > ~/.npmrc
2022-02-18 07:40:39 +00:00
echo "Publishing new version to npm"
2022-02-18 06:46:32 +00:00
npm publish
fi
- sh : |
YELLOW='\033[0;33m'
NC='\033[0m'
LOCK_FILE="${HOME}/build.lock"
export APPVEYOR_SSH_BLOCK=true
touch "${LOCK_FILE}"
echo -e "Build paused. To resume it, open a bash session to run '${YELLOW}rm \"${LOCK_FILE}\"${NC}' command."
while [ -f "${LOCK_FILE}" ]; do
sleep 1
done
2022-02-18 06:43:35 +00:00
# on build failure
on_failure :
- sh : echo on_failure