From 3ee7e6bf66da114cbbc6a9f2dd52555993944f0b Mon Sep 17 00:00:00 2001 From: Barun Acharya <47106543+daemon1024@users.noreply.github.com> Date: Sat, 11 Sep 2021 19:44:35 +0530 Subject: [PATCH] Publish to github pages through workflow on push --- .github/workflows/gh-pages.yml | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..806a681 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,44 @@ +name: github pages + +on: + push: + branches: + - main # Set a branch to deploy + +jobs: + deploy: + runs-on: ubuntu-20.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 + + - name: Hugo setup + uses: peaceiris/actions-hugo@v2.4.13 + + with: + hugo-version: 'latest' + extended: true + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Build + run: hugo --minify + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public