From fe3958594df46c000ef197f96f2e9f31435a221f Mon Sep 17 00:00:00 2001 From: Karan Sharma Date: Mon, 1 Jul 2024 17:19:15 +0530 Subject: [PATCH] ci: add npm caching --- .github/workflows/release.yml | 18 ++++++ .goreleaser.yml | 2 +- docs/astro.config.mjs | 104 +++++++++++++++++----------------- 3 files changed, 70 insertions(+), 54 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 717ad4f..b6f232c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,24 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Cache node modules + uses: actions/cache@v3 + with: + path: ./docs/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/docs/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Install dependencies + run: | + cd docs + yarn install + + - name: Build + run: | + cd docs + yarn build + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index 349dc11..34a29ac 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -44,7 +44,7 @@ builds: - -s -w -X "main.buildVersion={{ .Tag }} ({{ .ShortCommit }} {{ .Date }})" main: ./web/ hooks: - pre: sh -c 'cd ./docs/ && yarn build' + pre: sh -c 'cd ./docs/ && yarn && yarn build' archives: - id: cli diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 7f814fb..e723c20 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -1,58 +1,56 @@ -import { defineConfig } from 'astro/config'; -import starlight from '@astrojs/starlight'; +import { defineConfig } from "astro/config"; +import starlight from "@astrojs/starlight"; import { defineConfig, passthroughImageService } from "astro/config"; // https://astro.build/config export default defineConfig({ - image: { - service: passthroughImageService(), - }, - integrations: [ - starlight({ - title: 'Doggo', - customCss: [ - './src/assets/custom.css', - ], - social: { - github: 'https://github.com/mr-karan/doggo', - }, - sidebar: [ - { - label: 'Introduction', - items: [ - { label: 'Installation', link: '/intro/installation' }, - ], - }, - { - label: 'Usage Guide', - items: [ - { label: 'Examples', link: '/guide/examples' }, - { label: 'CLI Reference', link: '/guide/reference' }, - ], - }, - { - label: 'Resolvers', - items: [ - { label: 'Classic (UDP and TCP)', link: '/resolvers/classic' }, - { label: 'System', link: '/resolvers/system' }, - { label: 'DNS over HTTPS (DoH)', link: '/resolvers/doh' }, - { label: 'DNS over TLS (DoT)', link: '/resolvers/dot' }, - { label: 'DNSCrypt', link: '/resolvers/dnscrypt' }, - { label: 'DNS over HTTPS (DoQ)', link: '/resolvers/quic' }, - ], - }, - { - label: 'Features', - items: [ - { label: 'Output Formats', link: '/features/output' }, - { label: 'Multiple Resolvers', link: '/features/multiple' }, - { label: 'IPv4 and IPv6', link: '/features/ip' }, - { label: 'Reverse IP Lookups', link: '/features/reverse' }, - { label: 'Protocol Tweaks', link: '/features/tweaks' }, - { label: 'Shell Completions', link: '/features/shell' }, - ], - }, - ], - }), - ], + base: "/docs", + site: "https://doggo.karan.dev/docs", + image: { + service: passthroughImageService(), + }, + integrations: [ + starlight({ + title: "Doggo", + customCss: ["./src/assets/custom.css"], + social: { + github: "https://github.com/mr-karan/doggo", + }, + sidebar: [ + { + label: "Introduction", + items: [{ label: "Installation", link: "/intro/installation" }], + }, + { + label: "Usage Guide", + items: [ + { label: "Examples", link: "/guide/examples" }, + { label: "CLI Reference", link: "/guide/reference" }, + ], + }, + { + label: "Resolvers", + items: [ + { label: "Classic (UDP and TCP)", link: "/resolvers/classic" }, + { label: "System", link: "/resolvers/system" }, + { label: "DNS over HTTPS (DoH)", link: "/resolvers/doh" }, + { label: "DNS over TLS (DoT)", link: "/resolvers/dot" }, + { label: "DNSCrypt", link: "/resolvers/dnscrypt" }, + { label: "DNS over HTTPS (DoQ)", link: "/resolvers/quic" }, + ], + }, + { + label: "Features", + items: [ + { label: "Output Formats", link: "/features/output" }, + { label: "Multiple Resolvers", link: "/features/multiple" }, + { label: "IPv4 and IPv6", link: "/features/ip" }, + { label: "Reverse IP Lookups", link: "/features/reverse" }, + { label: "Protocol Tweaks", link: "/features/tweaks" }, + { label: "Shell Completions", link: "/features/shell" }, + ], + }, + ], + }), + ], });