From cdcd2225fd0a2aa9db6955934459fbdd2d826f1a Mon Sep 17 00:00:00 2001 From: EvanWong Date: Sun, 21 Jul 2024 00:37:49 +0800 Subject: [PATCH] ci(deploy-test.yml): add deploy test on PR --- .github/workflows/deploy-test.yml | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/deploy-test.yml diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml new file mode 100644 index 000000000..9347de7ab --- /dev/null +++ b/.github/workflows/deploy-test.yml @@ -0,0 +1,41 @@ +name: Deploy Test + +on: + pull_request: + branches: [master] + +jobs: + + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: Cache dependencies + uses: actions/cache@v3 + with: + key: mkdocs-material-${{ runner.os }}-${{ hashFiles('**/requirements.txt') }} + path: .cache + + - name: Install dependencies + run: | + pip3 install -U -r requirements.txt + + - name: Build site + run: mkdocs build + + - name: Check Deployment + run: | + if [ -d "site" ]; then + echo "Deploy would have succeeded!" + else + echo "Deploy would have failed!" + gh pr close ${{ github.event.pull_request.number }} + exit 1 + fi \ No newline at end of file