icons #30
This file contains hidden or 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 Assets & ESLint | |
| on: | |
| push: | |
| branches: [ master, main, renovatio ] | |
| pull_request: | |
| branches: [ master, main ] | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| workflow_dispatch: | |
| inputs: | |
| commit_assets: | |
| description: 'Commit and push built assets' | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: build/package.json | |
| - name: Install Node dependencies | |
| working-directory: build | |
| run: npm ci | |
| - name: Run ESLint on build config | |
| working-directory: build | |
| run: npx eslint config/**/*.js | |
| - name: Run ESLint on source files | |
| working-directory: assets/src | |
| run: npx eslint *.js --config ../../build/eslint.config.js | |
| - name: Build assets | |
| working-directory: build | |
| run: npm run build | |
| - name: Check if assets were built | |
| run: | | |
| ls -la assets/vidstack.min.js | |
| ls -la assets/vidstack.min.css | |
| - name: Commit and push built assets | |
| if: github.event.inputs.commit_assets == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add assets/vidstack.min.js assets/vidstack.min.css | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "chore: rebuild assets [skip ci]" | |
| git push | |
| fi | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: built-assets | |
| path: | | |
| assets/vidstack.min.js | |
| assets/vidstack.min.css | |
| retention-days: 7 |