Skip to content

Updating for 2024

Updating for 2024 #9

name: Versions Update
on:
push:
branches: [ master ]
paths:
- '.github/workflows/version_update.yml'
schedule:
# Run once on the first of the month
- cron: '45 0 1 * *'
jobs:
update:
name: Versions Update
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout submodules
uses: actions/checkout@v4
with:
fetch-depth: 0
path: advent-of-code-inputs
repository: zodac/advent-of-code-inputs
token: ${{ secrets.SUBMODULE_ACCESS }}
- name: Set up JDK 22
uses: actions/setup-java@v4.2.1
with:
distribution: 'temurin'
java-version: '22'
- name: Cache local .m2
uses: actions/cache@v4.0.2
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up maven
uses: s4u/setup-maven-action@v1.14.0
with:
java-distribution: 'temurin'
java-version: '22'
maven-version: '3.9.9'
- name: Update Maven project versions
run: mvn versions:update-properties
- name: Run linters and unit/integration tests
id: application_tests
run: mvn clean install -Dall
- name: Commit changes
id: change_commit
if: steps.application_tests.outcome == 'success'
run: |
git config user.name github-actions
git config user.email "actions@github.com"
git add .
git commit -m 'Updating versions'
- name: Push changes
uses: ad-m/github-push-action@v0.8.0
if: steps.change_commit.outcome == 'success'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master