Fix error handling
continuous-integration/appveyor/branch AppVeyor build succeeded Details

Jonatan Nilsson 2023-11-05 03:39:36 +00:00
parent 9c8e035847
commit 8c54606000
1 changed files with 3 additions and 15 deletions

View File

@ -9,22 +9,16 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v3
- name: Check for new release
continue-on-error: true_or_false
run: |
checkExitCode() {
if [ $1 -ne 0 ] ; then
echo "Command failed with error code $1"
exit $1
fi
}
cd ${{ gitea.job }}
CURR_VER="$(cat package.json | jq -r .name)_v$(cat package.json | jq -r .version)"
CURR_NAME="$(cat package.json | jq -r .name) v$(cat package.json | jq -r .version)"
echo "Checking https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases for name ${CURR_NAME}"
curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null
curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null || { curlexit=$?; }
if [ $? -eq 0 ] ; then
if [ $curlexit -eq 0 ] ; then
echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists";
exit 0;
fi
@ -33,8 +27,6 @@ jobs:
mv build-package.json package.json
npm install && npm run build
checkExitCode $?
mv package.json build-package.json
mv fuck-you-npm-package.json package.json
@ -47,8 +39,6 @@ jobs:
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases \
-d "{\"tag_name\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${{ gitea.sha }} :\n\n${{ gitea.event.head_commit.message }}\"}")
checkExitCode $?
RELEASE_ID=$(echo $RELEASE_RESULT | jq -r .id)
echo "Adding ${CURR_VER}_build-sc.7z to release ${RELEASE_ID}"
@ -57,8 +47,6 @@ jobs:
-H "Authorization: token ${{ secrets.deploytoken }}" \
-F "attachment=@${CURR_VER}_build-sc.7z" \
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets
checkExitCode $?
MAN_PORT=$(cat package.json | jq -r .port)
MAN_NAME=$(cat package.json | jq -r .name)