diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 3f03c7c..c8db3f3 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.0 +current_version = 0.1.1 commit = True tag = True diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml deleted file mode 100644 index fe90905..0000000 --- a/.github/workflows/create-release-pr.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Create Release PR -on: - workflow_dispatch: - inputs: - version_type: - description: "Version bump type" - required: true - default: "patch" - type: choice - options: - - patch - - minor - - major - -jobs: - create-release-pr: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install bump2version - run: pip install bump2version - - - name: Configure git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Bump version - run: | - bump2version ${{ github.event.inputs.version_type }} --verbose --no-commit --no-tag - echo "VERSION=$(python -c "from quickview import __version__; print(__version__)")" >> $GITHUB_ENV - - - name: Get commit hash for version bump - run: | - echo "COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV - - - name: Generate changelog for PR - id: changelog - run: | - # Get commits since last tag (excluding the version bump commit we just made) - LAST_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "") - if [ -z "$LAST_TAG" ]; then - COMMITS=$(git log --oneline --pretty=format:"- %s" HEAD~1) - else - COMMITS=$(git log --oneline --pretty=format:"- %s" ${LAST_TAG}..HEAD~1) - fi - - # Save changelog to file for multiline output - echo "## Changes in this release" > changelog.md - echo "" >> changelog.md - if [ -z "$COMMITS" ]; then - echo "- Initial release" >> changelog.md - else - echo "$COMMITS" >> changelog.md - fi - echo "" >> changelog.md - echo "## Version Details" >> changelog.md - echo "- **Previous version**: ${LAST_TAG:-"None (initial release)"}" >> changelog.md - echo "- **New version**: v${{ env.VERSION }}" >> changelog.md - echo "- **Release type**: ${{ github.event.inputs.version_type }}" >> changelog.md - - - name: Create Release Pull Request - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} - base: release - branch: release-v${{ env.VERSION }} - title: "Release v${{ env.VERSION }}" - commit-message: "chore: bump version to ${{ env.VERSION }}" - body-path: changelog.md - labels: | - release - ${{ github.event.inputs.version_type }} - assignees: ${{ github.actor }} - reviewers: ${{ github.actor }} - draft: false - delete-branch: false - - - name: Create PR body template - run: | - cat > pr_template.md << 'EOF' - ## Release v${{ env.VERSION }} - - This pull request contains all changes for the **v${{ env.VERSION }}** release. - - ### Release Checklist - - [x] Version bumped in all files (`__init__.py`, `pyproject.toml`, `tauri_conf.json`) - - [ ] All tests passing - - [ ] Documentation updated (if needed) - - [ ] Breaking changes documented (if any) - - [ ] Ready for production deployment - - $(cat changelog.md) - - ### Files Changed - - `__init__.py` - Version updated - - `pyproject.toml` - Version updated - - `tauri_conf.json` - Version updated - - ### Post-Merge Actions - After merging this PR: - 1. Tag `v${{ env.VERSION }}` will be created - 2. Tauri build will trigger automatically and create draft release with distributables - 3. Draft release will be published automatically after build completes - - ### Important Notes - - This is a **${{ github.event.inputs.version_type }}** release - - Review all changes carefully before merging - - Ensure all CI checks pass before merging - - --- - - **Release prepared by**: @${{ github.actor }} - **Release type**: ${{ github.event.inputs.version_type }} - **Target branch**: `release` - **Source commit**: ${{ env.COMMIT_SHA }} - EOF - - - name: Output PR information - run: | - echo "Release PR created successfully!" - echo "Version: v${{ env.VERSION }}" - echo "Release type: ${{ github.event.inputs.version_type }}" - echo "Check the Pull Requests tab to review and merge the release" diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml index fbb8940..55eaf9c 100644 --- a/.github/workflows/finalize-release.yml +++ b/.github/workflows/finalize-release.yml @@ -25,6 +25,7 @@ jobs: uses: actions/checkout@v4 with: ref: release + lfs: true - name: Get version from files run: | diff --git a/.github/workflows/package-and-release.yml b/.github/workflows/package-and-release.yml index f9785df..2269c09 100644 --- a/.github/workflows/package-and-release.yml +++ b/.github/workflows/package-and-release.yml @@ -20,6 +20,16 @@ jobs: runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v4 + with: + lfs: true + + - name: Verify LFS files + run: | + echo "Checking LFS files..." + ls -la quickview/data/ + file quickview/data/globe.vtk + file quickview/data/connectivity.nc + echo "LFS file check complete" - name: Get version for tagging id: get_version diff --git a/README.md b/README.md index 3f65027..a1a7b2a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # QuickView -[![CI](https://github.com/E3SM-Project/QuickView/actions/workflows/ci.yml/badge.svg)](https://github.com/E3SM-Project/QuickView/actions/workflows/ci.yml) -[![Pre-commit](https://github.com/E3SM-Project/QuickView/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/E3SM-Project/QuickView/actions/workflows/pre-commit.yml) +[![Test](https://github.com/ayenpure/QuickView/actions/workflows/test.yml/badge.svg)](https://github.com/ayenpure/QuickView/actions/workflows/test.yml) +[![Package and Release](https://github.com/ayenpure/QuickView/actions/workflows/package-and-release.yml/badge.svg)](https://github.com/ayenpure/QuickView/actions/workflows/package-and-release.yml) A scientific visualization application for exploring atmospheric data from the E3SM (Energy Exascale Earth System Model) project. diff --git a/pyproject.toml b/pyproject.toml index da74d7d..ebe6105 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "quickview" -version = "0.1.0" +version = "0.1.1" description = "An application to explore/analyze data for atmosphere component for E3SM" authors = [ {name = "Kitware Inc."}, diff --git a/quickview/__init__.py b/quickview/__init__.py index d52780e..0d46f69 100644 --- a/quickview/__init__.py +++ b/quickview/__init__.py @@ -1,5 +1,5 @@ """QuickView: Visual Analysis for E3SM Atmosphere Data.""" -__version__ = "0.1.0" +__version__ = "0.1.1" __author__ = "Kitware Inc." __license__ = "Apache-2.0" diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..3690034 --- /dev/null +++ b/release.sh @@ -0,0 +1,277 @@ +#!/bin/bash + +# Function to print output +print_status() { + echo "[INFO] $1" >&2 +} + +print_success() { + echo "[SUCCESS] $1" >&2 +} + +print_warning() { + echo "[WARNING] $1" >&2 +} + +print_error() { + echo "[ERROR] $1" >&2 +} + +# Function to show usage +show_usage() { + echo "Usage: $0 [patch|minor|major]" + echo "" + echo "This script will:" + echo " 1. Bump the version using bump2version" + echo " 2. Commit the changes to main" + echo " 3. Create a release PR from main to release branch" + echo "" + echo "Examples:" + echo " $0 patch # 0.1.0 -> 0.1.1" + echo " $0 minor # 0.1.0 -> 0.2.0" + echo " $0 major # 0.1.0 -> 1.0.0" +} + +# Function to check prerequisites +check_prerequisites() { + print_status "Checking prerequisites..." + + # Check if bump2version is installed + if ! command -v bump2version &> /dev/null; then + print_error "bump2version is not installed. Install it with: pip install bump2version" + exit 1 + fi + + # Check if gh CLI is installed + if ! command -v gh &> /dev/null; then + print_error "GitHub CLI is not installed. Install it from: https://cli.github.com/" + exit 1 + fi + + # Check if we're in a git repository + if ! git rev-parse --is-inside-work-tree &> /dev/null; then + print_error "Not in a git repository" + exit 1 + fi + + # Check if we're on main/master branch + current_branch=$(git branch --show-current) + if [[ "$current_branch" != "main" && "$current_branch" != "master" ]]; then + print_error "Must be on main or master branch. Currently on: $current_branch" + exit 1 + fi + + # Check if working directory is clean + if ! git diff-index --quiet HEAD --; then + print_error "Working directory is not clean. Please commit or stash your changes." + exit 1 + fi + + print_success "All prerequisites met" +} + +# Function to get current version from pyproject.toml +get_current_version() { + python -c "import tomllib; f=open(\"pyproject.toml\",\"rb\"); data=tomllib.load(f); f.close(); print(data[\"project\"][\"version\"])" +} + +# Function to get previous version from git tags +get_previous_version() { + git describe --tags --abbrev=0 2>/dev/null | sed "s/^v//" || echo "0.0.0" +} + +# Function to generate changelog +generate_changelog() { + local prev_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + + if [ -z "$prev_tag" ]; then + echo "- Initial release" + else + # Get commits since last tag, excluding merge commits + git log --oneline --pretty=format:"- %s" --no-merges ${prev_tag}..HEAD | head -15 + fi +} + +# Function to bump version +bump_version() { + local version_type=$1 + + print_status "Getting current version..." + local old_version=$(get_current_version) + print_status "Current version: v$old_version" + + # First, get what the new version will be + local new_version=$(bump2version --list $version_type --dry-run 2>/dev/null | grep "^new_version=" | cut -d= -f2) + if [ -z "$new_version" ]; then + print_error "Failed to determine new version" + exit 1 + fi + + print_status "Bumping $version_type version..." + # Now actually bump the version + bump2version $version_type --verbose >&2 + if [ $? -ne 0 ]; then + print_error "Failed to bump version" + exit 1 + fi + + print_success "Version bumped: v$old_version -> v$new_version" + + # Return just the clean version number + echo "$new_version" +} + +# Function to commit and push changes +commit_and_push() { + local version=$1 + local branch=$(git branch --show-current) + + # Debug: show what version we received + print_status "Received version for push: '$version'" >&2 + + print_status "Pushing changes to $branch..." + if ! git push origin $branch; then + print_error "Failed to push changes" + exit 1 + fi + + # Push the new tag (bump2version already created it) + print_status "Pushing new tag v${version}..." + if ! git push origin v${version}; then + # Check if tag already exists on remote + if git ls-remote --tags origin | grep -q "refs/tags/v${version}$"; then + print_warning "Tag v${version} already exists on remote" + else + print_error "Failed to push tag v${version}" + exit 1 + fi + fi + + print_success "Changes and tags pushed to $branch" +} + +# Function to create release PR +create_release_pr() { + local current_version=$1 + local previous_version=$(get_previous_version) + + # Determine release type + IFS="." read -ra CURRENT <<< "$current_version" + IFS="." read -ra PREVIOUS <<< "$previous_version" + + if [ "${CURRENT[0]}" != "${PREVIOUS[0]}" ]; then + release_type="major" + elif [ "${CURRENT[1]}" != "${PREVIOUS[1]}" ]; then + release_type="minor" + else + release_type="patch" + fi + + print_status "Generating changelog..." + local changelog=$(generate_changelog) + + print_status "Creating release PR..." + + # Create PR using GitHub CLI + gh pr create \ + --base release \ + --head $(git branch --show-current) \ + --title "Release v${current_version}" \ + --body "$(cat << EOF +## Release v${current_version} + +This pull request contains all changes for the **v${current_version}** release. + +### Release Information +- **Previous version**: v${previous_version} +- **New version**: v${current_version} +- **Release type**: ${release_type} +- **Release date**: $(date +%Y-%m-%d) + +### What Changed + +${changelog} + +### Release Checklist +- [x] Version bumped in all files +- [ ] All tests passing +- [ ] Documentation updated (if needed) +- [ ] Breaking changes documented (if any) +- [ ] Ready for production deployment + +### Files Updated +- quickview/__init__.py - Version updated to ${current_version} +- pyproject.toml - Version updated to ${current_version} +- src-tauri/tauri.conf.json - Version updated to ${current_version} +- src-tauri/Cargo.toml - Version updated to ${current_version} + +### Post-Merge Actions +After merging this PR: +1. Git tag v${current_version} will be available +2. Tauri build will trigger automatically +3. Draft release will be created with distributables +4. Release will be published automatically with release notes + +### Important Notes +- This is a **${release_type}** release +- Review all changes carefully before merging +- Ensure all CI checks pass before merging + +--- + +**Release prepared by**: @$(git config user.name) +**Release type**: ${release_type} +**Target branch**: release +**Commit count**: $(git rev-list --count HEAD ^$(git merge-base HEAD release) 2>/dev/null || echo "N/A") +EOF +)" \ + --assignee @me \ + --label "release,${release_type}" || { + print_error "Failed to create PR" + exit 1 + } + + print_success "Release PR created successfully!" +} + +# Main function +main() { + # Check if version type is provided + if [ $# -eq 0 ]; then + show_usage + exit 1 + fi + + local version_type=$1 + + # Validate version type + if [[ ! "$version_type" =~ ^(patch|minor|major)$ ]]; then + print_error "Invalid version type: $version_type" + show_usage + exit 1 + fi + + echo "QuickView Release Tool" + echo "======================" + + # Run checks + check_prerequisites + + # Bump version + local new_version=$(bump_version $version_type) + + # Commit and push changes + commit_and_push $new_version + + # Create release PR + create_release_pr $new_version + + echo "" + print_success "Release process completed!" + echo "Version: v$new_version ($version_type)" + echo "Review and merge the PR to trigger the release pipeline" + echo "PR URL: $(gh pr view --json url --jq .url 2>/dev/null || echo Check GitHub for PR link)" +} + +# Run main function +main "$@" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index e5f5c6f..d292009 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "0.1.0" +version = "0.1.1" description = "QuickView: Visual Analyis for E3SM Atmosphere Data" authors = ["Kitware"] license = "" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d3fd620..f6e7ce3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "package": { "productName": "QuickView", - "version": "0.1.0" + "version": "0.1.1" }, "tauri": { "allowlist": {