Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix astro build GitHub pages #6

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/setup-runtime/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Setup Node.js and pnpm

runs:
using: "composite"
steps:
- name: "Setup pnpm"
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
30 changes: 4 additions & 26 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Astro site to GitHub Pages
name: Deploy to GitHub Pages

on:
push:
Expand All @@ -25,38 +25,16 @@ jobs:
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Setup pnpm"
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: "20"
cache: 'pnpm'
- name: "Get pnpm store directory"
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: "Setup pnpm cache"
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: "Setup runtime"
uses: ./.github/actions/setup-runtime
- name: "Setup Pages"
id: pages
uses: actions/configure-pages@v4
- name: "Install dependencies"
run: pnpm install
working-directory: ${{ env.BUILD_PATH }}
- name: "Build with Astro"
run: |
pnpx astro build \
--site "${{ steps.pages.outputs.origin }}" \
--base "${{ steps.pages.outputs.base_path }}"
run: pnpm run build
working-directory: ${{ env.BUILD_PATH }}
- name: "Upload artifact"
uses: actions/upload-pages-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ import icon from "astro-icon";
// https://astro.build/config
export default defineConfig({
site: 'https://fernandoarteaga.dev',
// site: 'https://fernandoarteaga.github.io',
integrations: [mdx(), sitemap(), icon(), tailwind()]
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"build": "astro build",
"check": "astro check",
"preview": "astro preview",
"astro": "astro"
},
Expand Down