mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-16 22:43:13 +00:00
62
.github/workflows/build.yml
vendored
62
.github/workflows/build.yml
vendored
@@ -1,5 +1,6 @@
|
|||||||
name: build
|
name: Lint & build
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
@@ -7,24 +8,71 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
LINT_OS: 'ubuntu-latest'
|
||||||
|
LINT_NODE_VERSION: '20.x'
|
||||||
|
CACHE_KEY: 'hugo-hinode'
|
||||||
|
CACHE_PATH: '/tmp/hugo_cache_runner'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ${{ env.LINT_OS }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.LINT_NODE_VERSION }}
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: '**/package-lock.json'
|
||||||
|
|
||||||
|
- name: Perform clean install of npm
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Lint the source files
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: lint
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
node-version: [16.x, 18.x, 20.x]
|
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
node-version: [16.x, 18.x, 20.x]
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout repository
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
- run: npm ci
|
|
||||||
- run: npm run build
|
- name: Perform clean install of npm
|
||||||
- run: npm run build:example
|
run: npm ci
|
||||||
|
|
||||||
|
# Cache Hugo cachedir and resourcedir (configured in config/ci/hugo.toml) for each OS
|
||||||
|
# No additional cache invalidation is needed, Hugo uses checksums itself
|
||||||
|
- name: Use Hugo cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ env.CACHE_PATH }}
|
||||||
|
key: ${{ runner.os }}-${{ env.CACHE_KEY }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ env.CACHE_KEY }}
|
||||||
|
|
||||||
|
- name: Build main site
|
||||||
|
run: npm run build:cache
|
||||||
|
|
||||||
|
# The example site is to be published to demo.gethinode.com
|
||||||
|
- name: Build example site
|
||||||
|
run: npm run build:example:ci
|
||||||
|
31
.github/workflows/lint.yml
vendored
31
.github/workflows/lint.yml
vendored
@@ -1,31 +0,0 @@
|
|||||||
name: lint
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
branches: [ main ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [16.x, 18.x, 20.x]
|
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: 'npm'
|
|
||||||
cache-dependency-path: '**/package-lock.json'
|
|
||||||
|
|
||||||
- run: npm ci --ignore-scripts
|
|
||||||
- run: npm run lint
|
|
49
.github/workflows/npm-publish.yml
vendored
49
.github/workflows/npm-publish.yml
vendored
@@ -1,35 +1,36 @@
|
|||||||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
# This workflow will run tests using node and then publish a package to npmjs.org when a release is created
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
||||||
|
name: Publish package to npmjs
|
||||||
name: Node.js Package
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
branches: [ main ]
|
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [published]
|
||||||
|
|
||||||
|
env:
|
||||||
|
OS: 'ubuntu-latest'
|
||||||
|
NODE_VERSION: '16.x'
|
||||||
|
REGISTRY_URL: 'https://registry.npmjs.org/'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ env.OS }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout repository
|
||||||
- uses: actions/setup-node@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm test
|
|
||||||
|
|
||||||
publish-npm:
|
- name: Setup .npmrc file to publish to npm
|
||||||
needs: build
|
uses: actions/setup-node@v3
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: ${{ env.REGISTRY_URL }}
|
||||||
- run: npm ci
|
cache: 'npm'
|
||||||
- run: npm publish
|
cache-dependency-path: '**/package-lock.json'
|
||||||
|
|
||||||
|
- name: Perform clean install of npm
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Publish package to npm
|
||||||
|
run: npm publish
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
2
config/ci/hugo.toml
Normal file
2
config/ci/hugo.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cachedir = '/tmp/hugo_cache_runner/'
|
||||||
|
resourcedir = '/tmp/hugo_cache_runner/resources/'
|
@@ -22,7 +22,9 @@
|
|||||||
"start:prod": "hugo server --bind=0.0.0.0 --disableFastRender --printI18nWarnings -e production",
|
"start:prod": "hugo server --bind=0.0.0.0 --disableFastRender --printI18nWarnings -e production",
|
||||||
"prebuild": "npm run clean:public && npm run -s mod:install",
|
"prebuild": "npm run clean:public && npm run -s mod:install",
|
||||||
"build": "hugo --gc --minify",
|
"build": "hugo --gc --minify",
|
||||||
|
"build:cache": "npm run -s prebuild && hugo --gc --minify -e ci",
|
||||||
"build:example": "npm run -s prebuild && hugo --gc --minify -s exampleSite",
|
"build:example": "npm run -s prebuild && hugo --gc --minify -s exampleSite",
|
||||||
|
"build:example:ci": "npm run -s prebuild && hugo --gc --minify -s exampleSite -e ci",
|
||||||
"build:debug": "hugo -e debug --debug",
|
"build:debug": "hugo -e debug --debug",
|
||||||
"build:preview": "npm run build -D -F",
|
"build:preview": "npm run build -D -F",
|
||||||
"clean:public": "rimraf public",
|
"clean:public": "rimraf public",
|
||||||
|
Reference in New Issue
Block a user