rothsandro / eleventy-notes

A template for Eleventy to publish your personal notes or docs.
https://eleventy-notes.sandroroth.com/
127 stars 14 forks source link

Create GitHub Pages.md #53

Closed cezaraugusto closed 4 months ago

cezaraugusto commented 4 months ago

Add instructions about how to deploy to GitHub Pages via GitHub Action.

This is the same script I'm using to deploy my project (file ref), thought it would be cool to share so others can just copy/paste the setup.

Screenshot 2024-04-29 at 09 31 30
netlify[bot] commented 4 months ago

Deploy Preview for sensational-cranachan-4404c2 ready!

Name Link
Latest commit e8f9fb72ba9cedb37ec3da8616d420a47cd2098a
Latest deploy log https://app.netlify.com/sites/sensational-cranachan-4404c2/deploys/6633bdc2512d1d00080cb31b
Deploy Preview https://deploy-preview-53--sensational-cranachan-4404c2.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

rothsandro commented 4 months ago

Thanks for PR 🙏 I just formatted the file with Prettier so everything is properly aligned.

I'm not familiar with GitHub Actions, so let me ask two dumb questions:

semanticdata commented 4 months ago

Hello,

Please consider the action I use to deploy my notes. It only uses GitHub's own actions (checkout, setup-node, upload-pages-artifact, deploy-pages) along with their latest versions.

name: Deploy to GitHub Pages (npm)

on:
  workflow_dispatch:
  push:
    branches:
      - main

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: 'pages'
  cancel-in-progress: false

# Needed to deploy to GitHub pages subdomain. (E.g. `your-username.github.io/eleventy-notes/`)
env:
  ELEVENTY_NOTES_PATH_PREFIX: 'eleventy-notes' 

jobs:
  setup:
    name: Setup and Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        name: Checkout
      - uses: actions/setup-node@v4
        name: Setup Node
        with:
          node-version: 18
      - name: Install dependencies
        run: npm install --prefix .app
      - name: Build
        run: npm run build --prefix .app
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: .app/dist

  deploy:
    name: Deploy
    needs: setup
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

Hope this helps.

rothsandro commented 4 months ago

Thanks @semanticdata, I updated the docs.

rothsandro commented 4 months ago

Thanks again, @cezaraugusto and @semanticdata 🙏