Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into field_search
Browse files Browse the repository at this point in the history
  • Loading branch information
chaneylc committed Jan 9, 2025
2 parents a26bc4f + 09051c4 commit c86176a
Show file tree
Hide file tree
Showing 41 changed files with 625 additions and 254 deletions.
90 changes: 67 additions & 23 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,61 +14,74 @@ on:
types: [trigger-release]

jobs:
release:
check-changes:
runs-on: ubuntu-latest

outputs:
release_required: ${{ steps.release-check.outputs.release_required }}
bump_type: ${{ steps.release-check.outputs.bump_type }}
steps:

- name: Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.ACTIONS_PAT }}
fetch-depth: 0

- name: Determine Bump Type Based on Trigger
id: determine-bump-type
- name: Determine Release Type and Necessity
id: release-check
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
LAST_RELEASE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "LAST_RELEASE_TAG was $LAST_RELEASE_TAG"
echo "LAST_RELEASE_TAG: $LAST_RELEASE_TAG"
LAST_RELEASE_COMMIT=$(git rev-list -n 1 $LAST_RELEASE_TAG)
echo "LAST_RELEASE_COMMIT was $LAST_RELEASE_COMMIT"
echo "LAST_RELEASE_COMMIT: $LAST_RELEASE_COMMIT"
changed_files=$(git diff-tree --no-commit-id --name-only $LAST_RELEASE_COMMIT HEAD | grep '^app' || echo "none")
echo "Changed files: $changed_files"
if [ "$changed_files" != "none" ]; then
echo "App directory has changed since the last release, proceeding with new release"
echo "release_required=true" >> $GITHUB_OUTPUT
echo "bump_type=patch" >> $GITHUB_OUTPUT
else
echo "No app directory changes since the last release. Skipping release."
exit 0
echo "release_required=false" >> $GITHUB_OUTPUT
fi
BUMP_TYPE="patch"
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
BUMP_TYPE="${{ github.event.inputs.bump_type }}"
echo "release_required=true" >> $GITHUB_OUTPUT
echo "bump_type=${{ github.event.inputs.bump_type }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" == "repository_dispatch" ]; then
BUMP_TYPE="${{ github.event.client_payload.bump_type }}"
echo "release_required=true" >> $GITHUB_OUTPUT
echo "bump_type=${{ github.event.client_payload.bump_type }}" >> $GITHUB_OUTPUT
else
echo "Unknown trigger source."
exit 1
fi
release:
runs-on: ubuntu-latest
needs: check-changes
if: needs.check-changes.outputs.release_required == 'true'
steps:

if [[ ! "$BUMP_TYPE" =~ ^(major|minor|patch)$ ]]; then
echo "Invalid bump type: $BUMP_TYPE"
exit 1
fi
echo "BUMP_TYPE=$BUMP_TYPE" >> $GITHUB_ENV
- name: Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.ACTIONS_PAT }}
fetch-depth: 0

- name: Bump Version in version.properties
id: bump-version
run: |
echo "Bumping version with BUMP_TYPE: $BUMP_TYPE"
bump_type="${{ needs.check-changes.outputs.bump_type }}"
echo "Bumping version with BUMP_TYPE: $bump_type"
source version.properties
if [ "$BUMP_TYPE" == "major" ]; then
if [ "$bump_type" == "major" ]; then
majorVersion=$((majorVersion + 1))
minorVersion=0
patchVersion=0
elif [ "$BUMP_TYPE" == "minor" ]; then
elif [ "$bump_type" == "minor" ]; then
minorVersion=$((minorVersion + 1))
patchVersion=0
else
Expand All @@ -80,9 +93,42 @@ jobs:
echo "patchVersion=$patchVersion" >> version.properties
VERSION=$majorVersion.$minorVersion.$patchVersion
VERSION_CODE=$((majorVersion * 10000 + minorVersion * 100 + patchVersion))
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: Process Changelog Changes
- name: Update changelog.xml
id: update-changelog-xml
run: |
# Read the Unreleased section and process notes based on type
RELEASE_CONTENT="" CURRENT_TYPE=""
while IFS= read -r note; do
if [[ "$note" == "### Added"* ]]; then
CURRENT_TYPE="new"
elif [[ "$note" == "### Changed"* ]]; then
CURRENT_TYPE="info"
elif [[ "$note" == "### Fixed"* ]]; then
CURRENT_TYPE="bugfix"
elif [[ "$note" =~ ^- ]]; then
clean_note=$(echo "$note" | sed -E 's/^- //; s/ *\(.*\)//')
RELEASE_CONTENT+=" <${CURRENT_TYPE}>${clean_note}</${CURRENT_TYPE}>\n"
#pr_number=$(echo "$note" | grep -oP 'pull/\K[0-9]+' || echo "N/A")
#RELEASE_CONTENT+=" <${CURRENT_TYPE}>${clean_note} (#${pr_number})</${CURRENT_TYPE}>\n"
fi
done < <(sed -n '/## \[Unreleased\]/,/^## /p' CHANGELOG.md | sed '1,2d' | sed '$d')
# Generate, insert, and log the new release block
today=$(date +'%Y-%m-%d')
RELEASE_BLOCK=" <release date=\"$today\" versionCode=\"$VERSION_CODE\" versionName=\"v$VERSION\">\n"
RELEASE_BLOCK+="$RELEASE_CONTENT"
RELEASE_BLOCK+=" </release>"
sed -i "/<changelog>/a \\\n$RELEASE_BLOCK" app/src/main/res/raw/changelog.xml
echo "Generated release block:"
echo -e "$RELEASE_BLOCK"
- name: Process CHANGELOG.md
id: process-changelog
run: |
unreleased_section=$(sed -n '/## \[Unreleased\]/,/^## /p' CHANGELOG.md | sed '1,2d' | sed '$d')
Expand Down Expand Up @@ -149,9 +195,7 @@ jobs:
if: ${{ success() }}
uses: EndBug/add-and-commit@v7
with:
add: |
version.properties
CHANGELOG.md
add: "version.properties CHANGELOG.md app/src/main/res/raw/changelog.xml"
message: "Bump ${{ env.BUMP_TYPE }} and update changelog for v${{ env.VERSION }}"
token: ${{ secrets.ACTIONS_PAT }}

Expand Down
58 changes: 37 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

## [v6.0.2] - 2024-12-16

### Added
- Trial name included in BrAPI import and field details page (https://github.com/PhenoApps/Field-Book/pull/1121)
- Image EXIF tag metadata includes the device pitch, roll, and yaw at the time of capture (https://github.com/PhenoApps/Field-Book/pull/1115)
- Setting added to reset preferences to default (https://github.com/PhenoApps/Field-Book/pull/1118)

## [v6.0.3] - 2025-01-06

### Added

### Changed
- Fields with different BrAPI study IDs can now have the same name (https://github.com/PhenoApps/Field-Book/pull/1095)

- Swap navigation now changes position of entry/trait navigation instead of only behavior (https://github.com/PhenoApps/Field-Book/pull/1123)

### Fixed
- Min and max values now correctly saved for BrAPI traits (https://github.com/PhenoApps/Field-Book/pull/1103)
- Label print observations are now assigned to the correct entry when navigating before the print is complete (https://github.com/PhenoApps/Field-Book/pull/1109)
- Improved database export messaging (https://github.com/PhenoApps/Field-Book/pull/1112)
- Go to ID dialog now has cursor focus when opened (https://github.com/PhenoApps/Field-Book/pull/1108)

- Improved warnings for missing or corrupted storage directory (https://github.com/PhenoApps/Field-Book/pull/1122)
- Barcodes scanned for data entry are now correctly checked for valid values (https://github.com/PhenoApps/Field-Book/pull/1110)
- Percent traits imported via BrAPI without min and max values default to 0/100 (https://github.com/PhenoApps/Field-Book/pull/1127)

## [v6.0.2] - 2024-12-16

### Added
- Trial name included in BrAPI import and field details page (https://github.com/PhenoApps/Field-Book/pull/1121)
- Image EXIF tag metadata includes the device pitch, roll, and yaw at the time of capture (https://github.com/PhenoApps/Field-Book/pull/1115)
- Setting added to reset preferences to default (https://github.com/PhenoApps/Field-Book/pull/1118)

### Changed
- Fields with different BrAPI study IDs can now have the same name (https://github.com/PhenoApps/Field-Book/pull/1095)

### Fixed
- Min and max values now correctly saved for BrAPI traits (https://github.com/PhenoApps/Field-Book/pull/1103)
- Label print observations are now assigned to the correct entry when navigating before the print is complete (https://github.com/PhenoApps/Field-Book/pull/1109)
- Improved database export messaging (https://github.com/PhenoApps/Field-Book/pull/1112)
- Go to ID dialog now has cursor focus when opened (https://github.com/PhenoApps/Field-Book/pull/1108)

## [v6.0.1] - 2024-12-09

### Added
- Accession number now included for germplasm imported via BrAPI (https://github.com/PhenoApps/Field-Book/pull/1093)
- Option added at trait creation to keep keyboard closed when navigating to text traits (https://github.com/PhenoApps/Field-Book/pull/1102)
### Added
- Accession number now included for germplasm imported via BrAPI (https://github.com/PhenoApps/Field-Book/pull/1093)
- Option added at trait creation to keep keyboard closed when navigating to text traits (https://github.com/PhenoApps/Field-Book/pull/1102)
- Proximity check added to disable GeoNav when away from field (https://github.com/PhenoApps/Field-Book/pull/1098)
- Experimental setting to use media keys for entry/trait navigation and picture capture (https://github.com/PhenoApps/Field-Book/pull/1089)

### Changed
- Fields and traits that have already been imported are now hidden on the BrAPI import screen (https://github.com/PhenoApps/Field-Book/pull/1091)
### Changed
- Fields and traits that have already been imported are now hidden on the BrAPI import screen (https://github.com/PhenoApps/Field-Book/pull/1091)
- Long-pressing delete button on bottom toolbar will remove all observations for that trait (https://github.com/PhenoApps/Field-Book/pull/1099)
- Current time now used as lastSyncedTime when downloading Observations via BrAPI (https://github.com/PhenoApps/Field-Book/pull/1071)
- lastSyncedTime updated after creating/updating Observations (https://github.com/PhenoApps/Field-Book/pull/1071)
Expand Down Expand Up @@ -548,6 +560,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[v5.6.26]: https://github.com/PhenoApps/Field-Book/releases/tag/5.6.26

[v6.0.0]: https://github.com/PhenoApps/Field-Book/releases/tag/6.0.0

[v6.0.1]: https://github.com/PhenoApps/Field-Book/releases/tag/6.0.1
[v6.0.2]: https://github.com/PhenoApps/Field-Book/releases/tag/6.0.2
[v6.0.3]: https://github.com/PhenoApps/Field-Book/releases/tag/6.0.3
[v6.0.4]: https://github.com/PhenoApps/Field-Book/releases/tag/6.0.4

[v6.0.1]: https://github.com/PhenoApps/Field-Book/releases/tag/6.0.1
[v6.0.2]: https://github.com/PhenoApps/Field-Book/releases/tag/6.0.2
[v6.0.3]: https://github.com/PhenoApps/Field-Book/releases/tag/6.0.3
Loading

0 comments on commit c86176a

Please sign in to comment.