Skip to content

Generate configuration #19

Generate configuration

Generate configuration #19

name: Generate configuration
on:
workflow_dispatch:
schedule:
- cron: 0 23 * * * # Every 07:00 CST
concurrency: generateConfiguration
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
generateConfiguration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Generate cache primary key based on nodejs's and npm's version and package-lock.json's hash
id: version
shell: bash
run: echo "hash=node@$(node -v | grep -oP '(?<=^v)\d+')_npm@$(npm -v | grep -oP '^\d+')_package-lock@$(openssl dgst -sha3-512 package-lock.json | grep -oP '[\da-f]{128}')" >> $GITHUB_OUTPUT && cat $GITHUB_OUTPUT
- uses: actions/cache/restore@v3
name: Try to restore node_modules from cache
id: cache
with:
path: node_modules
key: ${{ steps.version.outputs.hash }}
- name: Install dependencies if no cache for node_modules
run: npm run ci
if: success() && steps.cache.outputs.cache-hit != 'true'
- uses: actions/cache/save@v3
if: success() && steps.cache.outputs.cache-hit != 'true'
name: Save node_modules to cache
with:
path: node_modules
key: ${{ steps.version.outputs.hash }}
- name: Prepare git
run: node scripts/postCommit/prepareGit.js
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Generate unrecognizable features
run: node scripts/generateUnrecognizableFeatures/index.js
- name: Generate user rights schema
run: node scripts/generateUserRightsSchema/index.js
- name: Show git status & push
run: node scripts/postCommit/push.js