Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow builds the project on every push and pull request to the main branch

name: AutoMapper CI

on:
pull_request:
branches: [ "main", "develop" ]

jobs:
build:
# Use the latest version of Ubuntu for the build environment
runs-on: ubuntu-latest

steps:
# Check out the repository code so the workflow can access it
- name: Checkout repository
uses: actions/checkout@v4

# Set up JDK 21, which is required by the project
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

# Cache Gradle packages and wrapper to speed up the build process
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

# Grant execute permission to the Gradle wrapper script
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

# Run the main build task
- name: Build with Gradle
run: ./gradlew build
41 changes: 41 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow prepares a new release by creating a pull request from 'develop' to 'main'.

name: AutoMapper Prepare Release

on:
workflow_dispatch:
inputs:
version:
description: 'The version to release (e.g., 1.0.0)'
required: true

jobs:
prepare-release:
runs-on: ubuntu-latest
steps:
- name: Checkout develop branch
uses: actions/checkout@v4
with:
ref: 'develop'

- name: Update version in build files and README
run: |
VERSION=${{ github.event.inputs.version }}
# Update version in processor/build.gradle.kts
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" automapper/processor/build.gradle.kts
# Update version in annotation/build.gradle.kts
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" automapper/annotation/build.gradle.kts
# Update dependency versions in README.md
sed -i 's/\(io\.github\.jacksever\.automapper:[^:]*:\)[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/\1$VERSION/g' README.md

- name: Create Pull Request to main
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Prepare release of Kotlin AutoMapper ${{ github.event.inputs.version }}"
title: "Prepare release of Kotlin AutoMapper ${{ github.event.inputs.version }}"
body: "This PR integrates changes from `develop` into `main` for the ${{ github.event.inputs.version }} release"
branch: "release/${{ github.event.inputs.version }}"
base: "main"
reviewers: ${{ github.actor }}
delete-branch: true
60 changes: 60 additions & 0 deletions .github/workflows/release-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow creates a tag, publishes to Maven Central, and creates a GitHub Release

name: AutoMapper Release and Publish

on:
push:
branches:
- 'main' # Triggers on any push to main, including merges

jobs:
release:
# This condition ensures the job only runs for merge commits from a release branch
if: startsWith(github.event.pull_request.title, 'Prepare release of Kotlin AutoMapper')
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract version from merge commit
id: get_version
run: |
COMMIT_MSG="${{ github.event.head_commit.message }}"
VERSION=$(echo "$COMMIT_MSG" | sed 's/Prepare release of Kotlin AutoMapper //')
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Create and push Git Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "${{ steps.get_version.outputs.version }}"
git push origin "${{ steps.get_version.outputs.version }}"

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

# - name: Publish to Maven Central
# run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel
# env:
# ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
# ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_TOKEN }}
# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SIGNING_KEY }}
# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}

- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: '${{ steps.get_version.outputs.version }}'
name: '${{ steps.get_version.outputs.version }}'
generateReleaseNotes: true
5 changes: 5 additions & 0 deletions automapper/annotation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ kotlin {
iosArm64()
iosSimulatorArm64()
js(IR) {
nodejs()
browser()
binaries.executable()
}

@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
nodejs()
binaries.executable()
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
nodejs()
browser()
binaries.executable()
}
}

Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

# Allows compiling Kotlin/Native code for Apple targets (e.g., iOS) on non-macOS hosts like Linux or Windows
kotlin.native.enableKlibsCrossCompilation=true

# Enables Gradle's build cache
org.gradle.caching=true
Empty file modified gradlew
100644 → 100755
Empty file.
5 changes: 5 additions & 0 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ kotlin {
iosArm64()
iosSimulatorArm64()
js(IR) {
nodejs()
browser()
binaries.executable()
}

@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
nodejs()
binaries.executable()
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
nodejs()
browser()
binaries.executable()
}

sourceSets {
Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pluginManagement {
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google {
content {
Expand Down