Skip to content

Commit

Permalink
fix: deployment via github actions
Browse files Browse the repository at this point in the history
This will replace the bash script with npm run commands and also add the missing deploy-pages script to the github workflow.
  • Loading branch information
marcopixel committed Aug 7, 2024
1 parent 284769b commit 66f44d3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 19 deletions.
47 changes: 41 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
name: Deploy Pages
name: Deploy to GitHub Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- master
branches: [$default-branch]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
deploy:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -18,6 +38,10 @@ jobs:
with:
node-version: 20.x

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

- name: Cache node_modules
uses: actions/cache@v4
with:
Expand All @@ -26,15 +50,26 @@ jobs:

- name: Install dependencies
run: |
npm install
npm ci
shell: bash

- name: Build
run: |
npm run build
shell: bash

- name: Upload Pages artifact
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
12 changes: 0 additions & 12 deletions build.sh

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"scripts": {
"start": "hexo server --log",
"generate": "hexo generate",
"build": "./build.sh",
"build": "npm run clean && npm run build:hexo && npm run build:css",
"build:hexo": "hexo generate",
"build:css": "postcss ./public/css/style.css --replace --verbose",
"clean": "hexo clean"
},
"dependencies": {
Expand Down

0 comments on commit 66f44d3

Please sign in to comment.