Skip to content

Commit

Permalink
update github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kajgm committed Jul 28, 2024
1 parent dd08072 commit 9c9d29b
Show file tree
Hide file tree
Showing 4 changed files with 12,586 additions and 6,675 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: node-ci

on:
push:
Expand All @@ -18,12 +15,12 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- run: npm ci
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: ./.github/workflows/setup-node

- name: Lint
run: npm run lint

Expand All @@ -33,16 +30,16 @@ jobs:
strategy:
matrix:
node-version: [20.x]
os: [ubuntu-20.04, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: ./.github/workflows/setup-node

- name: Build
run: npm run build

- name: Test
run: npm test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to Github Pages
name: publish

on:
# Enable Manual deployments
Expand All @@ -8,9 +8,9 @@ on:
# Required Permissions
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for actions/checkout
pages: write # Required for deployment
contents: read
pages: write
id-token: write

# Disable pages deployment concurrency
# https://docs.github.com/en/actions/using-jobs/using-concurrency
Expand All @@ -19,25 +19,21 @@ concurrency:
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-20.04
timeout-minutes: 10
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
uses: ./.github/workflows/setup-node

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Build
run: |
npm ci
npm run build
touch out/.nojekyll
echo "kajgm.com" > out/CNAME
Expand All @@ -49,14 +45,20 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: "out"
path: "./out"

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
needs: build

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
21 changes: 21 additions & 0 deletions .github/workflows/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: setup-node

runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Cache dependencies
id: cache_dependencies
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
shell: bash
if: steps.cache_dependencies.outputs.cache-hit != 'true'
run: npm ci
Loading

0 comments on commit 9c9d29b

Please sign in to comment.