generated from woodcox/11ty-sass-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.16 KB
/
11tybuild-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build 11ty and css
on:
push:
branches:
- main
# Cancel a previous build if still running
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Conditional environmental if's
env:
UPDATE_NPM: true # false = deploy eleventy , true = update npm
jobs:
build_deploy_eleventy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
if: env.UPDATE_NPM != 'true'
run: npm i # npm update --save
- name: Update dependencies
if: env.UPDATE_NPM == 'true'
run: npm update --save
- name: Npm Build
if: env.UPDATE_NPM != 'true'
run: npm run minify
- name: Commit buildmeta and manifest changes
if: env.UPDATE_NPM != 'true'
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Update json files"
add: '["*.json"]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Npm Rebuild # for buildmeta and manifest changes to take effect
if: env.UPDATE_NPM != 'true'
run: npm run minify
- name: Deploy
if: env.UPDATE_NPM != 'true'
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./dist
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: pull request on npm update
if: env.UPDATE_NPM == 'true'
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update dependencies
title: Update dependencies
body: |
- Dependency updates
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-dependencies
add-paths: | # to update the package.json and package-lock.json
*.json