On Push #102
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: "On Push" | |
on: | |
push: | |
schedule: | |
- cron: "0 7 * * *" | |
jobs: | |
deploy: | |
name: "Build & Test" | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
permissions: | |
id-token: write | |
# update repository | |
contents: write | |
steps: | |
- name: "Checkout [${{ github.ref || github.ref_name || github.head_ref }}]" | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 1 | |
token: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} | |
- name: "Restore cache [${{ runner.os }}-build-${{ hashFiles('**/pom.xml', '**/build.gradle*', '**/package-lock.json') }}]" | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.m2 | |
~/.gradle/caches | |
~/.gradle/wrapper | |
**/node_modules/* | |
~/.npm/ms-playwright | |
~/.cache/playwright | |
~/.cache/ms-playwright | |
~/.npm/ms-playwright | |
key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml', '**/build.gradle*', '**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml', '**/build.gradle*', '**/package-lock.json') }} | |
- name: "Read Java Info" | |
id: "java_info" | |
uses: YunaBraska/java-info-action@main | |
- name: "Setup Java [${{ steps.java_info.outputs.java_version }}] Builder [${{ steps.java_info.outputs.builder_name }}] [${{ steps.java_info.outputs.builder_version }}]" | |
uses: actions/setup-java@main | |
with: | |
java-version: ${{ steps.java_info.outputs.java_version }} | |
distribution: 'adopt' | |
- name: "Update" | |
id: "update" | |
run: | | |
${{ steps.java_info.outputs.cmd_update_wrapper }} | |
if [ "${{ steps.java_info.outputs.is_maven }}" == "true" ]; then | |
${{ steps.java_info.outputs.cmd_update_plugs }} | |
${{ steps.java_info.outputs.cmd_update_props }} | |
${{ steps.java_info.outputs.cmd_update_parent }} | |
fi | |
env: | |
GITHUB_USER: 'DuckGithubBot' | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} | |
MTP_PUBLIC_KEY: ${{ secrets.MTP_PUBLIC_KEY }} | |
MTP_TEST_VOUCHER: ${{ secrets.MTP_TEST_VOUCHER }} | |
- name: "Test" | |
run: ${{ steps.java_info.outputs.cmd_test_build }} | |
env: | |
GITHUB_USER: 'DuckGithubBot' | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} | |
MTP_PUBLIC_KEY: ${{ secrets.MTP_PUBLIC_KEY }} | |
MTP_TEST_VOUCHER: ${{ secrets.MTP_TEST_VOUCHER }} | |
- name: "Read Git Info" | |
id: "git_info" | |
with: | |
ignore-files: "package-lock.json" | |
uses: YunaBraska/git-info-action@main | |
- name: "Push Changes" | |
if: ${{ steps.git_info.outputs.has_changes == 'true' }} | |
run: | | |
git config --global user.name 'Kira Bot' | |
git config --global user.email '[email protected]' | |
git add . | |
git commit -m "chore(🔧): auto update" | |
git push origin HEAD:${{ github.ref || github.ref_name || github.head_ref }} |