Skip to content

Added alphabetical sorting to the "Select Project" dropdown #83

Added alphabetical sorting to the "Select Project" dropdown

Added alphabetical sorting to the "Select Project" dropdown #83

Workflow file for this run

name: Build
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: write
env:
JAVA_VERSION: '17'
JAVA_DISTRIBUTION: temurin
jobs:
calc_ver:
runs-on: ubuntu-latest
outputs:
project_ver: ${{ steps.ver.outputs.project_ver }}
release_flag: ${{ steps.ver.outputs.release_flag }}
release_tag: ${{ steps.ver.outputs.release_tag }}
release_upload_url: ${{ steps.ver.outputs.release_upload_url }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
cache: maven
- name: Auto-tag
if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.repository == 'nbclaudecodegui/NetbeansClaudeCodeGui'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
bash build-scripts/autotag.sh
- name: Calculate version
id: ver
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git fetch --prune --tags
# Release tag on current commit?
REL_TAG=$(git tag --points-at HEAD | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' || true)
if [[ -n "$REL_TAG" ]]; then
VER="$REL_TAG"
RELEASE=ON
# Create draft release if not yet exists
if ! gh release view "$REL_TAG" --json id -q .id &>/dev/null; then
NOTES=RELNOTES.md
[[ -f "$NOTES" ]] || echo "Release $VER" > "$NOTES"
gh release create "$REL_TAG" --draft --title "$VER" --notes-file "$NOTES"
fi
UPLOAD_URL=$(gh release view "$REL_TAG" --json uploadUrl -q .uploadUrl)
else
POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-.*//')
MM=$(echo "$POM_VERSION" | cut -d. -f1-2)
MM_ESC="${MM//./\\.}"
LAST_REL=$(git tag | grep -E "^${MM_ESC}\.[0-9]+$" | sort -V | tail -1)
BASE_TAG=$(git tag | grep -E "^${MM_ESC}$" | sort -V | tail -1 || echo "")
if [[ -n "$LAST_REL" ]]; then
START=$(echo "$LAST_REL" | cut -d. -f3)
N=$(git rev-list "${LAST_REL}..HEAD" --count 2>/dev/null || echo "0")
VER="${MM}.$((START + N))"
elif [[ -n "$BASE_TAG" ]]; then
N=$(git rev-list "${BASE_TAG}..HEAD" --count 2>/dev/null || echo "0")
VER="${MM}.${N}"
else
VER="${MM}.0"
fi
RELEASE=OFF
UPLOAD_URL=""
REL_TAG=""
fi
echo "project_ver=$VER" >> $GITHUB_OUTPUT
echo "release_flag=$RELEASE" >> $GITHUB_OUTPUT
echo "release_tag=$REL_TAG" >> $GITHUB_OUTPUT
echo "release_upload_url=$UPLOAD_URL" >> $GITHUB_OUTPUT
echo "Version: $VER (release=$RELEASE)"
build:
needs: calc_ver
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
cache: maven
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Install pandoc
run: sudo apt-get install -y pandoc
- name: Set version
run: mvn versions:set -DnewVersion=${{ needs.calc_ver.outputs.project_ver }} --batch-mode
- name: Build
# xvfb-run provides a virtual display so Swing UI tests don't throw HeadlessException
run: |
if [[ "${{ needs.calc_ver.outputs.release_flag }}" == "ON" ]]; then
xvfb-run mvn deploy -P release -DskipTests -DskipDeploy=true --batch-mode
else
xvfb-run mvn package --batch-mode
fi
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Build documentation
run: |
VERSION=${{ needs.calc_ver.outputs.project_ver }}
pandoc \
--metadata title="Claude Code GUI for NetBeans — User Manual" \
--embed-resources --standalone \
--resource-path=docs \
-o "target/netbeans-claude-code-gui-${VERSION}-docs.html" \
docs/installation.md \
docs/user-manual.md
- name: Upload artifact and release asset
uses: nanoufo/action-upload-artifacts-and-release-assets@v2
with:
path: |
target/*.nbm
target/*-docs.html
upload-release-files: ${{ needs.calc_ver.outputs.release_flag == 'ON' }}
release-upload-url: ${{ needs.calc_ver.outputs.release_upload_url }}
- name: Upload Central bundle
if: needs.calc_ver.outputs.release_flag == 'ON' && github.repository == 'nbclaudecodegui/NetbeansClaudeCodeGui'
uses: actions/upload-artifact@v4
with:
name: central-bundle
path: target/central-publishing/central-bundle.zip
if-no-files-found: error
release:
needs: [calc_ver, build]
if: needs.calc_ver.outputs.release_flag == 'ON' && github.repository == 'nbclaudecodegui/NetbeansClaudeCodeGui'
runs-on: ubuntu-latest
steps:
- name: Download Central bundle
uses: actions/download-artifact@v4
with:
name: central-bundle
path: central-bundle
- name: Publish to Maven Central
run: |
AUTH=$(echo -n "$MAVEN_USERNAME:$MAVEN_PASSWORD" | base64 -w0)
curl --fail --location \
--request POST \
--header "Authorization: Bearer $AUTH" \
--form "bundle=@central-bundle/central-bundle.zip" \
"https://central.sonatype.com/api/v1/publisher/upload?publishingType=AUTOMATIC"
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
- name: Publish GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release edit "${{ needs.calc_ver.outputs.release_tag }}" \
--draft=false \
--repo ${{ github.repository }}