-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (74 loc) · 2.18 KB
/
version_update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
uses: actions/setup-java@v4.2.1
with:
distribution: 'temurin'
java-version: '23'
- 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: '23'
maven-version: '3.9.9'
- name: Update Maven project versions
run: |
mvn versions:update-properties
if git diff-index --quiet HEAD; then
echo "No changes to commit"
echo "has_changes=false" >> $GITHUB_ENV
else
echo "has_changes=true" >> $GITHUB_ENV
fi
- name: Run linters and unit/integration tests
id: application_tests
if: env.has_changes == 'true'
run: mvn clean install -Dall
- name: Commit changes
id: change_commit
if: env.has_changes == 'true'
run: |
git config user.name github-actions
git config user.email "actions@github.com"
git add .
git commit -m 'Updating versions'
- name: Push changes
if: env.has_changes == 'true'
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master