Skip to content

Commit

Permalink
Bump mobile version in pr (#128)
Browse files Browse the repository at this point in the history
* update package.json version

* format

* chore: minor mobile app version bump

* update workflow

* chore: minor mobile app version bump

* chore: minor mobile app version bump

* chore: minor mobile app version bump

* add check

* chore: minor mobile app version bump

---------

Co-authored-by: Laurin-Notemann <Laurin-Notemann@users.noreply.github.com>
  • Loading branch information
Laurin-Notemann and Laurin-Notemann authored Nov 25, 2024
1 parent 0b06432 commit 326b766
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/bump-mobile-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,41 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
fetch-depth: 2

- name: Check recent commit messages
id: check_commits
shell: bash
run: |
# Fetch the PR base branch
git fetch origin ${{ github.base_ref }}
# Get the merge base between the PR head and base
MERGE_BASE=$(git merge-base HEAD origin/${{ github.base_ref }})
# Check the commits between the merge base and HEAD
COMMIT_MESSAGES=$(git log $MERGE_BASE..HEAD --format='%s')
echo "Commit messages since merge base:"
echo "$COMMIT_MESSAGES"
if echo "$COMMIT_MESSAGES" | grep -q "chore: minor mobile app version bump"; then
echo "has_version_bump=true" >> $GITHUB_OUTPUT
echo "A recent commit contains the version bump message. Stopping the workflow."
exit 0 # This will stop the workflow without failing it
else
echo "has_version_bump=false" >> $GITHUB_OUTPUT
echo "No version bump commit found. Continuing the workflow."
fi
- name: Setup Node.js
if: steps.check_commits.outputs.has_version_bump != 'true'
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Bump version
if: steps.check_commits.outputs.has_version_bump != 'true'
run: |
cd mobile-app
Expand All @@ -51,8 +78,10 @@ jobs:
echo "Updated version in package.json and app.json to $new_version"
- run: npm ci && npm run format
if: steps.check_commits.outputs.has_version_bump != 'true'
working-directory: mobile-app
- uses: stefanzweifel/git-auto-commit-action@v5
if: steps.check_commits.outputs.has_version_bump != 'true'
with:
commit_message: "chore: minor mobile app version bump"

15 changes: 8 additions & 7 deletions .github/workflows/generate-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:

- name: Check recent commit authors
id: check_authors
shell: bash
run: |
# Fetch the PR base branch
git fetch origin ${{ github.base_ref }}
Expand All @@ -43,19 +44,19 @@ jobs:
MERGE_BASE=$(git merge-base HEAD origin/${{ github.base_ref }})
# Check the commits between the merge base and HEAD
COMMIT_AUTHORS=$(git log $MERGE_BASE..HEAD --format='%h - %cn <%ce> - %s')
echo "Commit authors since merge base:"
echo "$COMMIT_AUTHORS"
COMMIT_MESSAGES=$(git log $MERGE_BASE..HEAD --format='%s')
echo "Commit messages since merge base:"
echo "$COMMIT_MESSAGES"
if echo "$COMMIT_AUTHORS" | grep -q "github-actions"; then
if echo "$COMMIT_MESSAGES" | grep -q "chore: update openapi types"; then
echo "has_bot_author=true" >> $GITHUB_OUTPUT
echo "A recent commit was authored by a GitHub bot. Stopping the workflow."
echo "A recent commit contains the version bump message. Stopping the workflow."
exit 0 # This will stop the workflow without failing it
else
echo "has_bot_author=false" >> $GITHUB_OUTPUT
echo "No recent commits by GitHub bot found. Continuing the workflow."
echo "No version bump commit found. Continuing the workflow."
fi
shell: bash
- name: Set up JDK 21 corretto
if: steps.check_authors.outputs.has_bot_author != 'true'
Expand Down
2 changes: 1 addition & 1 deletion mobile-app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "beerpong-tournament",
"slug": "mobile-app",
"version": "1.0.5",
"version": "1.0.6",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
Expand Down
2 changes: 1 addition & 1 deletion mobile-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mobile-app",
"main": "expo-router/entry",
"version": "1.0.0",
"version": "1.0.6",
"scripts": {
"prestart": "cp ../.env.example .env",
"start": "expo start",
Expand Down

0 comments on commit 326b766

Please sign in to comment.