|
1 |
| -name: Prep next development cycle post release |
| 1 | +name: Increments Flipcash versioning on the 1st of the month |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - tags: |
6 |
| - - 'v[0-9]+.[0-9]+.[0-9]' |
| 4 | + schedule: |
| 5 | + - cron: '0 0 1 * *' |
7 | 6 | workflow_dispatch:
|
8 | 7 |
|
9 | 8 | jobs:
|
|
17 | 16 | ref: main
|
18 | 17 | - uses: connor-baer/action-sync-branch@main
|
19 | 18 | with:
|
20 |
| - branch: develop |
| 19 | + branch: code/cash |
21 | 20 | token: ${{ secrets.GITHUB_TOKEN }}
|
22 | 21 | 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