diff --git a/.github/workflows/ci.yml b/.github/workflows/build.yml similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows/build.yml diff --git a/.github/workflows/deploy-mocks.yml b/.github/workflows/deploy-mocks.yml new file mode 100644 index 0000000..523c647 --- /dev/null +++ b/.github/workflows/deploy-mocks.yml @@ -0,0 +1,55 @@ +name: Deploy Mocks to Server + +on: + push: + branches: [ main ] + +jobs: + upload-mocks: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Detect changes in mocks/ + id: changes + run: | + echo "Fetching history..." + git fetch --unshallow || true + git log --oneline -n 5 || true + + echo "Checking for changes in mocks/..." + CHANGED=$(git diff --name-status HEAD~1 HEAD || true) + echo "Full diff output:" + echo "$CHANGED" + + MOCK_CHANGED=$(echo "$CHANGED" | grep -E '^[AMD]\s+mocks/' || true) + echo "Detected changes in mocks/:" + echo "$MOCK_CHANGED" + + { + echo "changed_files<> "$GITHUB_OUTPUT" + + - name: Show changed_files output + run: echo "changed_files = '${{ steps.changes.outputs.changed_files }}'" + + - name: Install rsync + run: | + sudo apt-get update + sudo apt-get install -y rsync + + - name: Upload mocks via SSH + if: steps.changes.outputs.changed_files != '' + env: + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_KEY: ${{ secrets.MOCKER_AT_APIMPOSTER }} + run: | + echo "$SSH_KEY" > gitea_key.pem + chmod 600 gitea_key.pem + rsync -avz --delete --no-perms --no-times \ + -e "ssh -i gitea_key.pem -o StrictHostKeyChecking=no" \ + mocks/ $SSH_HOST:/data0/mocks/ diff --git a/mocks/daisy/program.yaml b/mocks/daisy/program.yaml deleted file mode 100644 index 6c37caf..0000000 --- a/mocks/daisy/program.yaml +++ /dev/null @@ -1,135 +0,0 @@ -- method: "GET" - path: "/" - response: - status: 200 - headers: - Content-Type: "application/json" - body: - id: 12345 - name: ... - code: ... - name_en: ... - responsibleDepartment: - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - {} - - {} - - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - {} - - {} - educationalInstitution: - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - {} - - {} - - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - {} - - {} - type: MAGISTER - level: FIRST_CYCLE - - -- method: "GET" - path: "/{id}" - response: - status: 200 - headers: - Content-Type: "application/json" - body: - id: 12345 - name: ... - code: ... - name_en: ... - responsibleDepartment: - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - {} - - {} - - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - {} - - {} - educationalInstitution: - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - {} - - {} - - name_en: ... - id: 12345 - designation: ... - closed: true - name: ... - units: - - {} - - {} - type: MASTER - level: FIRST_CYCLE - -- method: "GET" - path: "/{id}/admissions" - response: - status: 500 - headers: - Content-Type: "application/json" - body: - - conditioned: false - kull: 12345 - discontinued: true - id: 12345 - studentId: 12345 - programId: 12345 - admissionSemester: 12345 diff --git a/mocks/test/test.yaml b/mocks/test/test.yaml index b839873..a91bf32 100644 --- a/mocks/test/test.yaml +++ b/mocks/test/test.yaml @@ -6,4 +6,4 @@ headers: Content-Type: "application/json" body: - name: "api test" + name: "api test 1"