diff --git a/.github/workflows/schema.yaml b/.github/workflows/schema.yaml new file mode 100644 index 00000000..e20ecca2 --- /dev/null +++ b/.github/workflows/schema.yaml @@ -0,0 +1,41 @@ +name: JSON Schema + +on: + push: + branches: + - main + paths: + - "**/*.go" + - ".github/workflows/schema.yaml" + +env: + GO_VERSION: 1.18 + +jobs: + schema: + name: JSON Schema + runs-on: ubuntu-latest + steps: + - name: Checkout Source Code + uses: actions/checkout@v3 + with: + token: ${{ secrets.MEGAEASE_BOT }} + + - name: Setup Go Environment + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Build EaseProbe + run: make + + - name: Generate JSON Schema + run: ./build/bin/easeprobe -j > resources/schema.json + + - name: Commit JSON Schema + uses: EndBug/add-and-commit@v7 + with: + message: "Update JSON Schema" + add: "resources/schema.json" + author_name: "GitHub Actions" + author_email: "actions@github.com" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1488b2b6..40af2409 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/ .vscode/ build/* -*.yaml \ No newline at end of file +*.yaml +!.github/workflows/*.yaml \ No newline at end of file