appveyor: Some refactoring
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
This commit is contained in:
parent
028688f738
commit
fc79ec8780
1 changed files with 53 additions and 60 deletions
113
appveyor.yml
113
appveyor.yml
|
@ -28,12 +28,12 @@ build_script:
|
|||
chmod -R 777 /appveyor/projects
|
||||
|
||||
apk add curl jq
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Finished installling curl and jq"
|
||||
else
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Finished installling curl and jq"
|
||||
|
||||
SUCCESS=1
|
||||
|
||||
for f in *; do
|
||||
|
@ -49,64 +49,57 @@ build_script:
|
|||
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo "Skipping $f since $CURR_NAME already exists";
|
||||
else
|
||||
rm base
|
||||
cp -Rf ../base ./base
|
||||
|
||||
mv package.json fuck-you-npm-package.json
|
||||
mv build-package.json package.json
|
||||
|
||||
npm install
|
||||
CHECK=$?
|
||||
if [ $CHECK -ne 0 ]; then
|
||||
echo "Command failed with error code $CHECK"
|
||||
SUCCESS=0;
|
||||
continue;
|
||||
fi;
|
||||
|
||||
npm run build
|
||||
CHECK=$?
|
||||
if [ $CHECK -ne 0 ]; then
|
||||
echo "Command failed with error code $CHECK"
|
||||
SUCCESS=0;
|
||||
continue;
|
||||
fi;
|
||||
|
||||
mv package.json build-package.json
|
||||
mv fuck-you-npm-package.json package.json
|
||||
|
||||
../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public
|
||||
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\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${APPVEYOR_REPO_COMMIT} :\n\n${APPVEYOR_REPO_COMMIT_MESSAGE}\"}")
|
||||
CHECK=$?
|
||||
if [ $CHECK -ne 0 ]; then
|
||||
echo "Command failed with error code $CHECK"
|
||||
SUCCESS=0;
|
||||
continue;
|
||||
fi;
|
||||
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
|
||||
CHECK=$?
|
||||
if [ $CHECK -ne 0 ]; then
|
||||
echo "Command failed with error code $CHECK"
|
||||
SUCCESS=0;
|
||||
continue;
|
||||
fi;
|
||||
|
||||
echo "Deplying to production"
|
||||
echo "curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME"
|
||||
curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME
|
||||
continue;
|
||||
fi
|
||||
|
||||
rm base
|
||||
cp -Rf ../base ./base
|
||||
|
||||
mv package.json fuck-you-npm-package.json
|
||||
mv build-package.json package.json
|
||||
|
||||
npm install && npm run build
|
||||
CHECK=$?
|
||||
if [ $CHECK -ne 0 ]; then
|
||||
echo "Command failed with error code $CHECK"
|
||||
SUCCESS=0;
|
||||
continue;
|
||||
fi;
|
||||
|
||||
mv package.json build-package.json
|
||||
mv fuck-you-npm-package.json package.json
|
||||
|
||||
../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public
|
||||
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\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${APPVEYOR_REPO_COMMIT} :\n\n${APPVEYOR_REPO_COMMIT_MESSAGE}\"}")
|
||||
CHECK=$?
|
||||
if [ $CHECK -ne 0 ]; then
|
||||
echo "Command failed with error code $CHECK"
|
||||
SUCCESS=0;
|
||||
continue;
|
||||
fi;
|
||||
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
|
||||
CHECK=$?
|
||||
if [ $CHECK -ne 0 ]; then
|
||||
echo "Command failed with error code $CHECK"
|
||||
SUCCESS=0;
|
||||
continue;
|
||||
fi;
|
||||
|
||||
echo "Deplying to production"
|
||||
echo "curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME"
|
||||
curl -X POST http://192.168.93.50:$MAN_PORT/update/$MAN_NAME
|
||||
cd ..
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue