From dc6e3d58882e248f160aa254b83fde1ecc0a0dd7 Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Sun, 5 Nov 2023 03:45:07 +0000 Subject: [PATCH] Remove appveyor and use gitea actions instead. --- .gitea/workflows/discord_embed.yaml | 58 +++++++++++++ .gitea/workflows/nfp_moe.yaml | 58 +++++++++++++ .gitea/workflows/saproxy.yaml | 58 +++++++++++++ appveyor.yml | 127 ---------------------------- nfp_moe/package.json | 2 +- 5 files changed, 175 insertions(+), 128 deletions(-) create mode 100644 .gitea/workflows/discord_embed.yaml create mode 100644 .gitea/workflows/nfp_moe.yaml create mode 100644 .gitea/workflows/saproxy.yaml delete mode 100644 appveyor.yml diff --git a/.gitea/workflows/discord_embed.yaml b/.gitea/workflows/discord_embed.yaml new file mode 100644 index 0000000..53206b7 --- /dev/null +++ b/.gitea/workflows/discord_embed.yaml @@ -0,0 +1,58 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +jobs: + nfp_moe: + runs-on: alpine + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Check for new release + run: | + 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 || { curlexit=$?; } + + if [ $curlexit -eq 0 ] ; then + echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists"; + exit 0; + fi + echo "New release ${CURR_VER} found, running npm install..." + + mv package.json fuck-you-npm-package.json + mv build-package.json package.json + npm install && npm run build + + mv package.json build-package.json + mv fuck-you-npm-package.json package.json + + chmod +x ../7zas + ../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public + + echo "Creating ${CURR_VER} release on gitea" + RELEASE_RESULT=$(curl \ + -X POST \ + -H "Authorization: token ${{ secrets.deploytoken }}" \ + -H "Content-Type: application/json" \ + 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 }}\"}") + + 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 ${{ secrets.deploytoken }}" \ + -F "attachment=@${CURR_VER}_build-sc.7z" \ + https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets + + MAN_PORT=$(cat package.json | jq -r .port) + MAN_NAME=$(cat package.json | jq -r .name) + + 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 \ No newline at end of file diff --git a/.gitea/workflows/nfp_moe.yaml b/.gitea/workflows/nfp_moe.yaml new file mode 100644 index 0000000..53206b7 --- /dev/null +++ b/.gitea/workflows/nfp_moe.yaml @@ -0,0 +1,58 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +jobs: + nfp_moe: + runs-on: alpine + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Check for new release + run: | + 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 || { curlexit=$?; } + + if [ $curlexit -eq 0 ] ; then + echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists"; + exit 0; + fi + echo "New release ${CURR_VER} found, running npm install..." + + mv package.json fuck-you-npm-package.json + mv build-package.json package.json + npm install && npm run build + + mv package.json build-package.json + mv fuck-you-npm-package.json package.json + + chmod +x ../7zas + ../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public + + echo "Creating ${CURR_VER} release on gitea" + RELEASE_RESULT=$(curl \ + -X POST \ + -H "Authorization: token ${{ secrets.deploytoken }}" \ + -H "Content-Type: application/json" \ + 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 }}\"}") + + 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 ${{ secrets.deploytoken }}" \ + -F "attachment=@${CURR_VER}_build-sc.7z" \ + https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets + + MAN_PORT=$(cat package.json | jq -r .port) + MAN_NAME=$(cat package.json | jq -r .name) + + 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 \ No newline at end of file diff --git a/.gitea/workflows/saproxy.yaml b/.gitea/workflows/saproxy.yaml new file mode 100644 index 0000000..53206b7 --- /dev/null +++ b/.gitea/workflows/saproxy.yaml @@ -0,0 +1,58 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +jobs: + nfp_moe: + runs-on: alpine + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Check for new release + run: | + 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 || { curlexit=$?; } + + if [ $curlexit -eq 0 ] ; then + echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists"; + exit 0; + fi + echo "New release ${CURR_VER} found, running npm install..." + + mv package.json fuck-you-npm-package.json + mv build-package.json package.json + npm install && npm run build + + mv package.json build-package.json + mv fuck-you-npm-package.json package.json + + chmod +x ../7zas + ../7zas a -xr!*.xcf -mx9 "${CURR_VER}_build-sc.7z" package.json index.mjs api base public + + echo "Creating ${CURR_VER} release on gitea" + RELEASE_RESULT=$(curl \ + -X POST \ + -H "Authorization: token ${{ secrets.deploytoken }}" \ + -H "Content-Type: application/json" \ + 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 }}\"}") + + 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 ${{ secrets.deploytoken }}" \ + -F "attachment=@${CURR_VER}_build-sc.7z" \ + https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets + + MAN_PORT=$(cat package.json | jq -r .port) + MAN_NAME=$(cat package.json | jq -r .name) + + 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 \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b763eba..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,127 +0,0 @@ -# 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: - docker_image: node:16-alpine - npm_config_cache: /appveyor/projects/cache - -build_script: - - sh: | - chown -R node:node /appveyor/projects - chmod -R 777 /appveyor/projects - - apk add curl jq - if [ $? -ne 0 ]; then - exit 1 - fi - - echo "Finished installling curl and jq" - - SUCCESS=1 - - echo "" - echo "Checking following projects:" - for f in *; do - [ -d "$f" ] && [ ! -L "$f" ] && [ ! "$f" = "base" ] && echo " * $f"; - done - echo "" - - for f in *; do - [ ! -d "$f" ] || [ -L "$f" ] || [ "$f" = "base" ] && continue; - echo "" - echo "------------------------------------" - echo "" - echo "checking $f"; - cd $f - 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)" - MAN_PORT=$(cat package.json | jq -r .port) - MAN_NAME=$(cat package.json | jq -r .name) - echo "Checking https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases for name ${CURR_NAME}" - curl -s -X GET -H "Authorization: token $deploytoken" https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null - - if [ $? -eq 0 ] ; then - echo "Skipping $f since $CURR_NAME already exists"; - cd .. - 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; - cd .. - 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; - cd .. - 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; - cd .. - 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 - - if [ $SUCCESS -eq 0 ]; then - echo "One or more jobs failed to build" - exit 1; - fi; - -# on build failure -on_failure: - - sh: echo on_failure diff --git a/nfp_moe/package.json b/nfp_moe/package.json index c4e61f0..ecccf03 100644 --- a/nfp_moe/package.json +++ b/nfp_moe/package.json @@ -1,6 +1,6 @@ { "name": "nfp_moe", - "version": "2.1.3", + "version": "2.1.4", "port": 4110, "description": "NFP Moe website", "main": "index.js",