Skip to content

Commit d0fc5d8

Browse files
committed
update dependencies, slim GHA
1 parent 431b67e commit d0fc5d8

File tree

3 files changed

+16313
-217
lines changed

3 files changed

+16313
-217
lines changed
Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: build-and-deploy
22

3-
on: [push]
3+
on: [push,workflow_dispatch]
44

55
env:
66
BRANCH_NAME: ${{ github.ref_name }}
@@ -9,45 +9,40 @@ jobs:
99
build-and-deploy:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: checkout code
13-
uses: actions/checkout@v4
14-
- name: setup node
15-
uses: actions/setup-node@v4
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
1614
with:
17-
node-version: 20
18-
# cache: "npm"
15+
node-version: lts/*
1916
- name: install slidevjs + playwright
2017
run: 'npm i -g @slidev/cli && npm i -D playwright-chromium'
18+
- name: Get npm cache directory
19+
id: npm-cache-dir
20+
shell: bash
21+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
22+
- name: Cache node modules
23+
uses: actions/cache@v4
24+
id: cache
25+
with:
26+
path: ${{ steps.npm-cache-dir.outputs.dir }}
27+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
28+
restore-keys: |
29+
${{ runner.os }}-node-
30+
- name: install dependencies
31+
if: steps.cache.outputs.cache-hit != 'true'
32+
run: 'npm i'
2133
- name: build slides
2234
run: 'yes | slidev build'
23-
# - name: upload build
24-
# uses: actions/upload-artifact@v3
25-
# with:
26-
# name: build
27-
# path: dist
28-
- name: Install Netlify
29-
run: npm install [email protected] -g
35+
- name: Get short commit SHA
36+
id: vars
37+
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
3038
- name: Deploy to Netlify
3139
id: netlify_deploy
3240
run: |
3341
prod_flag=""
3442
if [ "$BRANCH_NAME" = "main" ]; then prod_flag="--prod"; fi
3543
netlify deploy \
36-
--dir dist \
44+
--dir dist \
45+
--message "CLI deploy via ${{ github.ref_name }}: commit ${{ steps.vars.outputs.sha_short }}, ${{ github.event.commits[0].message }}" \
3746
--site ${{ secrets.NETLIFY_SITE_ID }} \
3847
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \
3948
$prod_flag
40-
41-
# deploy:
42-
# needs: build
43-
# runs-on: ubuntu-latest
44-
# name: 'Deploy to Netlify'
45-
# steps:
46-
# - uses: jsmrcaga/[email protected]
47-
# with:
48-
# build_directory: dist
49-
# build_command: 'npm i -g @slidev/cli ; npm i -D playwright-chromium ; yes | slidev build'
50-
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
51-
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
52-
# NETLIFY_DEPLOY_MESSAGE: "Prod deploy v${{ github.ref }}"
53-
# NETLIFY_DEPLOY_TO_PROD: true

0 commit comments

Comments
 (0)