Update dependencies (#85) #1072
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |