diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..872d067 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,45 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - main + pull_request: + +jobs: + deploy: + runs-on: ubuntu-22.04 + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Cache npm + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} + + - name: Cache Eleventy .cache + uses: actions/cache@v3 + with: + path: ./.cache + key: ${{ runner.os }}-eleventy-fetch-cache + + + - run: npm install + - run: npm run build-ghpages + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_site diff --git a/.gitignore b/.gitignore index ab338d7..83253a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ _site/ node_modules/ package-lock.json +.cache diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 1308e54..11e085e 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -56,6 +56,6 @@ - + diff --git a/eleventy.config.images.js b/eleventy.config.images.js index b5de176..fb9bfe7 100644 --- a/eleventy.config.images.js +++ b/eleventy.config.images.js @@ -14,7 +14,7 @@ export default function(eleventyConfig) { // e.g. assigned on the HTML tag will override these values. defaultAttributes: { loading: "lazy", - decoding: "async" - } + decoding: "async", + }, }); }; diff --git a/eleventy.config.js b/eleventy.config.js index 7be6c48..1111878 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -94,6 +94,10 @@ export default async function(eleventyConfig) { }); }); + eleventyConfig.addShortcode("currentBuildDate", () => { + return (new Date()).toISOString(); + }) + // Features to make your build faster (when you need them) // If your passthrough copy gets heavy and cumbersome, add this line