diff --git a/.github/actions/setup-runtime/action.yaml b/.github/actions/setup-runtime/action.yaml new file mode 100644 index 0000000..1eda80f --- /dev/null +++ b/.github/actions/setup-runtime/action.yaml @@ -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 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 05e4b62..b0630e9 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,4 +1,4 @@ -name: Deploy Astro site to GitHub Pages +name: Deploy to GitHub Pages on: push: @@ -25,27 +25,8 @@ 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 @@ -53,10 +34,7 @@ jobs: 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 diff --git a/astro.config.mjs b/astro.config.mjs index be5ff35..03ce4cd 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -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()] }); \ No newline at end of file diff --git a/package.json b/package.json index 882db95..a6dd835 100644 --- a/package.json +++ b/package.json @@ -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" },