Delete .claude directory #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Package & Release Plugin | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| release: | |
| types: [ created ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '8' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Grant execute permission for Gradle wrapper | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| - name: Extract project info | |
| run: | | |
| PROJECT_NAME=$(./gradlew properties -q | grep "^name:" | awk '{print $2}') | |
| VERSION=$(./gradlew properties -q | grep "^version:" | awk '{print $2}') | |
| echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Upload plugin artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Plugin | |
| path: build/libs/${{ env.PROJECT_NAME }}-*.jar | |
| - name: Delete existing GitHub release (if exists) | |
| run: | | |
| RELEASE_ID=$(gh release view ${{ env.VERSION }} --json id -q '.id' || echo "") | |
| if [ -n "$RELEASE_ID" ]; then | |
| echo "Deleting existing release..." | |
| gh release delete ${{ env.VERSION }} --yes | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Delete existing tag (if exists) | |
| run: | | |
| if git rev-parse "${{ env.VERSION }}" >/dev/null 2>&1; then | |
| echo "Deleting existing tag..." | |
| git tag -d ${{ env.VERSION }} | |
| git push origin :refs/tags/${{ env.VERSION }} | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Prepare release JAR | |
| run: | | |
| JAR_FILE=$(ls build/libs/${{ env.PROJECT_NAME }}-*.jar | grep -vE '(-sources|-javadoc|-all).jar' | head -n 1) | |
| cp "$JAR_FILE" build/libs/${{ env.PROJECT_NAME }}-latest.jar | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ env.VERSION }} | |
| name: Release ${{ env.VERSION }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| build/libs/${{ env.PROJECT_NAME }}-latest.jar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout Maven repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: CroaBeast/repo | |
| path: maven-repo | |
| token: ${{ secrets.MAVEN_DEPLOY_TOKEN }} | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| - name: Deploy to Maven repository | |
| run: | | |
| NAME=${{ env.PROJECT_NAME }} | |
| # Create directory structure | |
| mkdir -p maven-repo/me/croabeast/${NAME}/${{ env.VERSION }} | |
| # Copy JAR files | |
| cp build/libs/${NAME}-${{ env.VERSION }}.jar \ | |
| maven-repo/me/croabeast/${NAME}/${{ env.VERSION }}/ | |
| cp build/libs/${NAME}-${{ env.VERSION }}-javadoc.jar \ | |
| maven-repo/me/croabeast/${NAME}/${{ env.VERSION }}/ | |
| cp build/libs/${NAME}-${{ env.VERSION }}-sources.jar \ | |
| maven-repo/me/croabeast/${NAME}/${{ env.VERSION }}/ | |
| # Create POM file | |
| cat > maven-repo/me/croabeast/${NAME}/${{ env.VERSION }}/${NAME}-${{ env.VERSION }}.pom << EOF | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>me.croabeast</groupId> | |
| <artifactId>${NAME}</artifactId> | |
| <version>${{ env.VERSION }}</version> | |
| <packaging>jar</packaging> | |
| </project> | |
| EOF | |
| # Update or create maven-metadata.xml | |
| cat > maven-repo/me/croabeast/${NAME}/maven-metadata.xml << EOF | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <metadata> | |
| <groupId>me.croabeast</groupId> | |
| <artifactId>${NAME}</artifactId> | |
| <versioning> | |
| <latest>${{ env.VERSION }}</latest> | |
| <release>${{ env.VERSION }}</release> | |
| <versions> | |
| <version>${{ env.VERSION }}</version> | |
| </versions> | |
| <lastUpdated>$(date +%Y%m%d%H%M%S)</lastUpdated> | |
| </versioning> | |
| </metadata> | |
| EOF | |
| # Commit and push changes | |
| cd maven-repo | |
| git add . | |
| git commit -m "Deploy ${NAME} ${{ env.VERSION }}" | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |