From eadcef120e76835c660ac1440ca022f708124efe Mon Sep 17 00:00:00 2001 From: realaravinth Date: Fri, 29 Oct 2021 20:06:36 +0530 Subject: [PATCH] CI: auto deploy --- .github/workflows/main.yml | 59 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 374b220..82d3617 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,43 +3,48 @@ name: github pages on: push: branches: - - master # Set a branch to deploy + - master # Set a branch to deploy jobs: build: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 - with: - submodules: true # Fetch Hugo themes (true OR recursive) - fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + - uses: actions/checkout@v2 + with: + submodules: true # Fetch Hugo themes (true OR recursive) + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - name: Use Node.js - uses: actions/setup-node@v2 - with: - node-version: 15 + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: 15 - - name: Install Hugo - uses: peaceiris/actions-hugo@v2 - with: - hugo-version: 'latest' - extended: true + - name: Install Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: "latest" + extended: true - - name: Check install Hugo - run: hugo version + - name: Check install Hugo + run: hugo version - - name: Install dependencies - run: npm ci + - name: Install dependencies + run: npm ci - - name: Delete temporary directories - run: npm run clean + - name: Delete temporary directories + run: npm run clean - - name: Build production website - run: npm run build + - name: Build production website + run: npm run build - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + + - name: deploy + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + run: >- + curl --location --request POST "https://deploy.batsense.net/api/v1/update" --header 'Content-Type: application/json' --data-raw "{ \"secret\": \"${{ secrets.DEPLOY_TOKEN }}\", \"branch\": \"gh-pages\" }"