CI: auto deploy

This commit is contained in:
Aravinth Manivannan 2021-10-29 20:06:36 +05:30
parent 7ef879481d
commit eadcef120e
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
1 changed files with 32 additions and 27 deletions

View File

@ -3,43 +3,48 @@ name: github pages
on: on:
push: push:
branches: branches:
- master # Set a branch to deploy - master # Set a branch to deploy
jobs: jobs:
build: build:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true # Fetch Hugo themes (true OR recursive) submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Use Node.js - name: Use Node.js
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 15 node-version: 15
- name: Install Hugo - name: Install Hugo
uses: peaceiris/actions-hugo@v2 uses: peaceiris/actions-hugo@v2
with: with:
hugo-version: 'latest' hugo-version: "latest"
extended: true extended: true
- name: Check install Hugo - name: Check install Hugo
run: hugo version run: hugo version
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Delete temporary directories - name: Delete temporary directories
run: npm run clean run: npm run clean
- name: Build production website - name: Build production website
run: npm run build run: npm run build
- name: Deploy - name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public 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\" }"