diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..1460cfe --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github:xemantic diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml new file mode 100644 index 0000000..41408dc --- /dev/null +++ b/.github/workflows/build-branch.yml @@ -0,0 +1,27 @@ +name: Build branch +on: + push: + branches-ignore: + - main + pull_request: + branches-ignore: + - main + +jobs: + build_branch: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4.2.2 + + - name: Setup Java + uses: actions/setup-java@v4.5.0 + with: + distribution: 'temurin' + java-version: 23 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4.2.1 + + - name: Build + run: ./gradlew build diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml new file mode 100644 index 0000000..f36cfce --- /dev/null +++ b/.github/workflows/build-main.yml @@ -0,0 +1,26 @@ +name: Build main +on: + push: + branches: + - main +jobs: + build_main: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4.2.2 + + - name: Setup Java + uses: actions/setup-java@v4.5.0 + with: + distribution: 'temurin' + java-version: 23 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4.2.1 + + - name: Build + run: ./gradlew build sourcesJar dokkaGeneratePublicationHtml publish + env: + ORG_GRADLE_PROJECT_githubActor: ${{ secrets.GITHUBACTOR }} + ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUBTOKEN }} diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..3a3f9a0 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,68 @@ +name: Build release +on: + release: + types: [published] +jobs: + build_release: + runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + steps: + - name: Write release version + run: | + VERSION=${GITHUB_REF_NAME#v} + echo Version: $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Checkout sources + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v4.5.0 + with: + distribution: 'temurin' + java-version: 23 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4.2.1 + + - name: Build + env: + ORG_GRADLE_PROJECT_githubActor: ${{ secrets.GITHUBACTOR }} + ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUBTOKEN }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_sonatypeUser: ${{ secrets.SONATYPE_USER }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + run: ./gradlew -Pversion=$VERSION build sourcesJar dokkaGeneratePublicationHtml publishToSonatype closeAndReleaseSonatypeStagingRepository + + - name: Find branch from tag + id: find-branch + env: + TAG_NAME: ${{ github.event.release.tag_name }} + run: | + BRANCH=$(git branch -r --contains $TAG_NAME | grep -v '\->' | sed 's/origin\///' | head -n 1) + if [ -z "$BRANCH" ]; then + echo "Branch not found for tag $TAG" + exit 1 + fi + echo Branch: $BRANCH + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + + - name: Checkout branch HEAD + run: git checkout ${BRANCH} + +# - name: Update README +# run: sed -i "s/com\.xemantic\.anthropic:anthropic-sdk-kotlin:[0-9]\+\(\.[0-9]\+\)*\>/com.xemantic.anthropic:anthropic-sdk-kotlin:$VERSION/g" README.md + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7.0.5 + with: + token: ${{ secrets.WORKFLOW_SECRET }} + commit-message: README.md gradle dependencies update to ${{ env.VERSION }} + title: PR Action - README.md gradle dependencies update to ${{ env.VERSION }} diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..2e19eca --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,24 @@ +name: GitHub Actions Version Updater + +# Controls when the action will run. +on: + schedule: + # Automatically run on every Sunday + - cron: '0 0 * * 0' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Git checkout + uses: actions/checkout@v4.2.2 + with: + # [Required] Access token with `workflow` scope. + token: ${{ secrets.WORKFLOW_SECRET }} + + - name: Run GitHub Actions Version Updater + uses: saadmk11/github-actions-version-updater@v0.8.1 + with: + # [Required] Access token with `workflow` scope. + token: ${{ secrets.WORKFLOW_SECRET }}