Skip to content

Commit f30fcaa

Browse files
authored
build: update prep-dev to be utilized for flipcash
1 parent 711f386 commit f30fcaa

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

.github/workflows/prep-dev.yml

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Prep next development cycle post release
1+
name: Increments Flipcash versioning on the 1st of the month
22

33
on:
4-
push:
5-
tags:
6-
- 'v[0-9]+.[0-9]+.[0-9]'
4+
schedule:
5+
- cron: '0 0 1 * *'
76
workflow_dispatch:
87

98
jobs:
@@ -17,6 +16,54 @@ jobs:
1716
ref: main
1817
- uses: connor-baer/action-sync-branch@main
1918
with:
20-
branch: develop
19+
branch: code/cash
2120
token: ${{ secrets.GITHUB_TOKEN }}
2221
force: false
22+
23+
- name: Generate year and month
24+
id: date
25+
run: |
26+
YEAR=$(date +"%Y")
27+
MONTH=$(date +"%m")
28+
echo "YEAR=$YEAR" >> $GITHUB_OUTPUT
29+
echo "MONTH=$MONTH" >> $GITHUB_OUTPUT
30+
31+
- name: Verify Packaging.kt exists
32+
run: |
33+
if [ ! -f buildSrc/src/main/java/Packaging.kt ]; then
34+
echo "Error: Packaging.kt not found"
35+
exit 1
36+
fi
37+
38+
- name: Validate updated fields
39+
run: |
40+
if ! grep -A 10 'object Flipcash {' buildSrc/src/main/java/Packaging.kt | grep -q "const val majorVersion = ${{ steps.date.outputs.YEAR }}"; then
41+
echo "Error: Failed to update majorVersion to ${{ steps.date.outputs.YEAR }}"
42+
exit 1
43+
fi
44+
if ! grep -A 10 'object Flipcash {' buildSrc/src/main/java/Packaging.kt | grep -q "const val minorVersion = ${{ steps.date.outputs.MONTH }}"; then
45+
echo "Error: Failed to update minorVersion to ${{ steps.date.outputs.MONTH }}"
46+
exit 1
47+
fi
48+
49+
- name: Check for changes
50+
id: check-changes
51+
run: |
52+
if git diff --quiet buildSrc/src/main/java/Packaging.kt; then
53+
echo "No changes to commit"
54+
echo "changed=false" >> $GITHUB_OUTPUT
55+
else
56+
echo "Changes detected"
57+
echo "changed=true" >> $GITHUB_OUTPUT
58+
fi
59+
60+
- name: Commit and push changes
61+
if: steps.check-changes.outputs.changed == 'true'
62+
run: |
63+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
64+
git config --local user.name "github-actions[bot]"
65+
git add buildSrc/src/main/java/Packaging.kt
66+
git commit -m "build: update Flipcash versioning to ${{ steps.date.outputs.YEAR }}.${{ steps.date.outputs.MONTH }}"
67+
git push
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)