commit files during CI workflow if build successful #5
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: CI build | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'java/**' | |
- 'src/**' | |
- 'action.yml' | |
- 'package.json' | |
- 'package-lock.json' | |
- 'webpack.config.js' | |
- '.github/workflows/buildci.yml' | |
tags-ignore: | |
- 'v*.*.*' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'java/**' | |
- 'src/**' | |
- 'action.yml' | |
- 'package.json' | |
- 'package-lock.json' | |
- 'webpack.config.js' | |
- '.github/workflows/buildci.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: Build with Maven | |
run: mvn -B package --file java/pom.xml | |
- name: Run tests | |
run: mvn -B test --file java/pom.xml | |
# Build with npm | |
- name: Build with npm | |
run: npm run buildWebpackU | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: collect action descriptor and npm build | |
path: | | |
action.yml | |
bundle/ | |
- name: Configure Git | |
run: | | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
- name: Commit and push built files | |
run: | | |
git add bundle/ | |
git commit -m "Automated build update" | |
git push | |