Skip to content

Bump tj-actions/verify-changed-files from 17 to 19 #173

Bump tj-actions/verify-changed-files from 17 to 19

Bump tj-actions/verify-changed-files from 17 to 19 #173

Workflow file for this run

name: Build Monorepo
# automated packer.js
# repo : https://github.com/dimaslanjaka/nodejs-package-types/blob/main/.github/workflows/build-release.yml
# raw : https://raw.githubusercontent.com/dimaslanjaka/nodejs-package-types/main/.github/workflows/build-release.yml
# update : curl -L https://github.com/dimaslanjaka/nodejs-package-types/raw/main/.github/workflows/build-release.yml > .github/workflows/build-release.yml
on:
push:
branches: [ "monorepo" ]
paths-ignore:
- '**/*.tgz'
- '**/*.gz'
- '**/release/**'
- '**garbage-collector**'
- '**codeql**'
pull_request:
types:
- closed
paths-ignore:
- '**/release/**'
- '**/*.tgz'
- '**/*.gz'
- '**/test*/**'
workflow_dispatch:
# run single job
concurrency:
group: build-monorepo
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: true
max-parallel: 6
runs-on: ubuntu-latest
name: Build Monorepo
steps:
- uses: actions/checkout@v4
with:
# repository: dimaslanjaka/nodejs-package-types
token: ${{ secrets.ACCESS_TOKEN }}
- name: Set env
id: set-env
shell: bash
run: |
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
echo "GITHUB_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GITHUB_COMMIT_URL=https://github.com/${{github.repository}}/commit/$(echo $GITHUB_SHA)" >> $GITHUB_ENV
echo "GITHUB_RUNNER_URL=https://github.com/${{github.repository}}/commit/${{github.sha}}/checks/${{github.run_id}}" >> $GITHUB_ENV
echo "CACHE_NPM=$(npm config get cache)" >> $GITHUB_ENV
echo "CACHE_YARN=$(yarn cache dir)" >> $GITHUB_ENV
echo "CACHE_YARN2=$(yarn config get cacheFolder)" >> $GITHUB_ENV
echo "cache-npm=$(npm config get cache)" >> $GITHUB_OUTPUT
echo "cache-yarn=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "cache-yarn2=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Get env
run: |
echo "branch : ${{ env.GITHUB_BRANCH }}"
echo "commit msg : ${{ github.event.head_commit.message }}"
echo "commit hash : ${{ env.GITHUB_SHA_SHORT }}"
echo "commit url : ${{ env.GITHUB_COMMIT_URL }}"
echo "runner url : ${{ env.GITHUB_RUNNER_URL }}"
echo "cache npm : ${{ env.CACHE_NPM }}"
echo "cache yarn : ${{ env.CACHE_YARN }}"
echo "cache yarn2 : ${{ env.CACHE_YARN2 }}"
- name: Set EOL git configs
continue-on-error: true
run: |
git config core.eol lf
git config core.autocrlf input
git checkout-index --force --all
- name: Pull & update submodules recursively
continue-on-error: true
run: |
git submodule update --init --recursive
git submodule update --recursive --remote
git pull -X theirs
- name: initialize nodejs
uses: actions/setup-node@v4
with:
node-version: 18.x
architecture: x64
token: ${{ secrets.ACCESS_TOKEN }}
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Enable corepack
run: corepack enable
- uses: actions/cache@v4
id: cache
with:
path: |
${{ steps.set-env.outputs.cache-npm }}
${{ steps.set-env.outputs.cache-yarn }}
${{ steps.set-env.outputs.cache-yarn2 }}
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
${{ runner.os }}-
- name: Check Updates
shell: bash
continue-on-error: true
run: npm run update
- name: Install Global Packages
run: npm i -g typescript ts-node gulp-cli hexo-cli webpack-cli
- name: Install Legacy Peer Dependencies
run: npm install --legacy-peer-deps
id: install-legacy
shell: bash
continue-on-error: true
- name: Install Verbose
if: steps.install-legacy.outcome == 'failure'
id: install-verbose
continue-on-error: true
shell: bash
run: |
rm -rf node_modules
npm install --verbose
- name: Install Update Binary
id: install-update
if: steps.install-verbose.outcome == 'failure'
shell: bash
run: |
rm -rf node_modules
npm install --no-shrinkwrap --update-binary
continue-on-error: true
- name: Clean Install
id: install-clean
shell: bash
if: steps.install-update.outcome == 'failure'
run: rm -rf node_modules package-lock.json && npm install
- name: Dump Installations
run: |
echo "install-legacy.outcome ${{ steps.install-legacy.outcome }}"
echo "install-legacy.conclusion ${{ steps.install-legacy.conclusion }}"
echo "install-verbose.outcome ${{ steps.install-verbose.outcome }}"
echo "install-verbose.conclusion ${{ steps.install-verbose.conclusion }}"
echo "install-update.outcome ${{ steps.install-update.outcome }}"
echo "install-update.conclusion ${{ steps.install-update.conclusion }}"
echo "install-clean.outcome ${{ steps.install-clean.outcome }}"
echo "install-clean.conclusion ${{ steps.install-clean.conclusion }}"
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: List the state of node modules
shell: bash
continue-on-error: true
run: npm list
- name: Build
run: npm run build
- name: Pack
run: npm run pack
# https://github.com/marketplace/actions/verify-changed-files
- name: Check if there are changes
id: changes
uses: tj-actions/verify-changed-files@v19
with:
files: |
release
dist
lib
!node_modules
!tmp
- shell: bash
name: "What's changed?"
run: |
echo "Changed files: ${{ steps.changes.outputs.changed_files }}"
- name: Git setup user email
if: steps.changes.outputs.files_changed == 'true'
continue-on-error: true
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- run: git add release
if: steps.changes.outputs.files_changed == 'true'
continue-on-error: true
- run: git add dist
if: steps.changes.outputs.files_changed == 'true'
continue-on-error: true
- run: git add lib
if: steps.changes.outputs.files_changed == 'true'
continue-on-error: true
- run: git add postinstall.js packer.js .github
if: steps.changes.outputs.files_changed == 'true'
continue-on-error: true
- run: git pull -X theirs
name: Pull before push
if: steps.changes.outputs.files_changed == 'true'
continue-on-error: true
- name: Git push
if: steps.changes.outputs.files_changed == 'true'
continue-on-error: true
run: |
git commit -m "Update build from ${{ env.GITHUB_COMMIT_URL }}" -m "commit hash: ${{ env.GITHUB_SHA_SHORT }}" -m "commit url: ${{ env.GITHUB_COMMIT_URL }}" -m "runner: ${{ env.GITHUB_RUNNER_URL }}"
git push