This repository has been archived by the owner on Feb 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Switch to MavenCentral for publishing (#84)
* switch to MavenCentral publishing * fix version.sh * Update README.md
- Loading branch information
Showing
8 changed files
with
175 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
org.gradle.daemon=false | ||
org.gradle.parallel=true | ||
org.gradle.jvmargs=-Xmx4608m -XX:MaxMetaspaceSize=1536m -XX:+HeapDumpOnOutOfMemoryError | ||
kotlin.compiler.execution.strategy=in-process |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
CWD="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
PARENT="$(cd "$CWD"/.. >/dev/null 2>&1 && pwd)" | ||
|
||
set -e | ||
|
||
SEMVER_REG="([[:digit:]]+(\.[[:digit:]]+)+)" | ||
|
||
README_FILE="$PARENT/README.md" | ||
VERSION_FILE="$PARENT/gradle/libs.versions.toml" | ||
|
||
NEW_VERSION="$ORG_GRADLE_PROJECT_VERSION_NAME" | ||
if [ -z "$NEW_VERSION" ]; then | ||
NEW_VERSION="$1" | ||
if [ -n "$NEW_VERSION" ]; then | ||
echo "Update README with version: '$NEW_VERSION'" | ||
|
||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
# Update artifact versions in README.md | ||
sed -i '' -E "s/\:$SEMVER_REG\"\)/\:$NEW_VERSION\"\)/" "$README_FILE" | ||
|
||
# Update version catalog in README.md | ||
sed -i '' -E "s/transformerkt = \"$SEMVER_REG\"/transformerkt = \"$NEW_VERSION\"/" "$README_FILE" | ||
else | ||
sed -i -E "s/\:$SEMVER_REG\"/\:$NEW_VERSION\"/g" "$README_FILE" | ||
sed -i -E "s/transformerkt = \"$SEMVER_REG\"/transformerkt = \"$NEW_VERSION\"/g" "$README_FILE" | ||
fi | ||
fi | ||
fi | ||
|
||
# Update Kotlin badge in README.md | ||
LIBS_KOTLIN_VERSION=$(grep "kotlin = " "$VERSION_FILE" | cut -d= -f2 | tr -d ' "') | ||
if [ -z "$LIBS_KOTLIN_VERSION" ]; then | ||
echo "Unable to find Kotlin version in '$VERSION_FILE'" | ||
else | ||
echo "Updating Kotlin version: '$LIBS_KOTLIN_VERSION'" | ||
sed -i '' -E "s/kotlin-v$SEMVER_REG/kotlin-v$LIBS_KOTLIN_VERSION/" "$README_FILE" | ||
fi | ||
|
||
# Update Media3 badge in README.md | ||
LIBS_MEDIA3_VERSION=$(grep "androidx-media3 = " "$VERSION_FILE" | cut -d= -f2 | tr -d ' "') | ||
if [ -z "$LIBS_MEDIA3_VERSION" ]; then | ||
echo "Unable to find Media3 version in '$VERSION_FILE'" | ||
else | ||
echo "Updating Media3 version: '$LIBS_MEDIA3_VERSION'" | ||
sed -i '' -E "s/media3#$SEMVER_REG/media3#$LIBS_MEDIA3_VERSION/" "$README_FILE" | ||
sed -i '' -E "s/media3-$SEMVER_REG/media3-$LIBS_MEDIA3_VERSION/" "$README_FILE" | ||
sed -i '' -E "s/version \`$SEMVER_REG/version \`$LIBS_MEDIA3_VERSION/" "$README_FILE" | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Publish | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [ prereleased, released ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
name: Publish library | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.release.tag_name }} | ||
|
||
- name: Copy CI gradle.properties | ||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | ||
|
||
- name: setup-java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
distribution: adopt | ||
|
||
- name: Gradle Wrapper Validation | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
- name: Deploy to Sonatype | ||
run: | | ||
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3) | ||
echo "New version: ${NEW_VERSION}" | ||
export ORG_GRADLE_PROJECT_VERSION_NAME=${NEW_VERSION} | ||
echo "RELEASE_VERSION=$NEW_VERSION" >> "$GITHUB_ENV" | ||
./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache --stacktrace | ||
env: | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | ||
|
||
- name: Update README for ${{ env.RELEASE_VERSION }} | ||
run: ./.github/version.sh "${RELEASE_VERSION}" | ||
|
||
- name: Commit changes to README to ${{ env.branch }} | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: "./README.md" | ||
message: "Update README.md with version ${{env.RELEASE_VERSION}}" | ||
new_branch: main | ||
|
||
documentation: | ||
name: "Generate Documentation" | ||
runs-on: ubuntu-latest | ||
needs: release | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
distribution: adopt | ||
|
||
- name: Gradle Wrapper Validation | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
- name: Generate documentation | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: :transformerkt:dokkaHtml | ||
|
||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: transformerkt/build/dokka/html |
This file contains 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
This file contains 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
This file contains 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
This file contains 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