Deploy mocks #2
55
.github/workflows/deploy-mocks.yml
vendored
Normal file
55
.github/workflows/deploy-mocks.yml
vendored
Normal file
@ -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<<EOF"
|
||||||
|
echo "$MOCK_CHANGED"
|
||||||
|
echo "EOF"
|
||||||
|
} >> "$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/
|
||||||
@ -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
|
|
||||||
@ -6,4 +6,4 @@
|
|||||||
headers:
|
headers:
|
||||||
Content-Type: "application/json"
|
Content-Type: "application/json"
|
||||||
body:
|
body:
|
||||||
name: "api test"
|
name: "api test 1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user