Skip to content

Commit

Permalink
github build added
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Dec 4, 2024
1 parent 1e4aa28 commit 38b9c29
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github:xemantic
27 changes: 27 additions & 0 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]

- name: Setup Java
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 23

- name: Setup Gradle
uses: gradle/actions/[email protected]

- name: Build
run: ./gradlew build
26 changes: 26 additions & 0 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build main
on:
push:
branches:
- main
jobs:
build_main:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/[email protected]

- name: Setup Java
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 23

- name: Setup Gradle
uses: gradle/actions/[email protected]

- name: Build
run: ./gradlew build sourcesJar dokkaGeneratePublicationHtml publish
env:
ORG_GRADLE_PROJECT_githubActor: ${{ secrets.GITHUBACTOR }}
ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUBTOKEN }}
68 changes: 68 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
fetch-depth: 0

- name: Setup Java
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 23

- name: Setup Gradle
uses: gradle/actions/[email protected]

- 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/[email protected]
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 }}
24 changes: 24 additions & 0 deletions .github/workflows/updater.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
# [Required] Access token with `workflow` scope.
token: ${{ secrets.WORKFLOW_SECRET }}

- name: Run GitHub Actions Version Updater
uses: saadmk11/[email protected]
with:
# [Required] Access token with `workflow` scope.
token: ${{ secrets.WORKFLOW_SECRET }}

0 comments on commit 38b9c29

Please sign in to comment.