Files
mushroom-strategy/.github/workflows/webpack.yml
T
DigiLive 4257a6cc68 Fix Webpack workflow
The commit action fails if the new build is the same as the existing
build. Now, Git checks for unchanged files first.
2025-06-01 12:57:05 +02:00

78 lines
2.1 KiB
YAML

name: Build distribution with Webpack
on:
push:
branches:
- main
jobs:
check-for-changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check_files.outputs.any_changed }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changed source files
id: check_files
uses: tj-actions/changed-files@v46
with:
files: |
src/**
webpack.config.js
build:
name: Build Distribution
runs-on: ubuntu-latest
timeout-minutes: 10
needs: check-for-changes
if: needs.check-for-changes.outputs.changed == 'true'
env:
CI_COMMIT_AUTHOR: 'CI Bot'
CI_COMMIT_EMAIL: 'ci@noreply.github.com'
CI_COMMIT_MESSAGE: |
Continuous Integration - Build Distribution
[skip codacy]
strategy:
matrix:
node-version: [22.x]
steps:
- name: Generate GitHub App Token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
fetch-depth: 0
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Build Distribution
run: npm run build
- name: Commit Distribution Build
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
git remote set-url origin https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/DigiLive/mushroom-strategy.git
git add dist
git diff --quiet && git diff --staged --quiet || (git commit -m "${{ env.CI_COMMIT_MESSAGE }}" && git push)