Skip to content

Commit

Permalink
Merge pull request #3 from pixincreate/add-prod-ci
Browse files Browse the repository at this point in the history
ci(prod): Automated deployments to prod environment [#3]
  • Loading branch information
pixincreate authored Oct 23, 2023
2 parents 8fb3e14 + 69be814 commit e17f629
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Deploy Hugo Website

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true

- name: Install Dart Sass
run: sudo snap install dart-sass

- name: Setup Pages
id: pages
uses: actions/configure-pages@v3

- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"

- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify \
--environment "${HUGO_ENVIRONMENT}" \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./public

- name: Deploy
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: "pixincreate_dev"
directory: ./public
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit e17f629

Please sign in to comment.