diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 0a0452669..0a5d792cb 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,3 @@ -name-template: 'v$NEXT_PATCH_VERSION ๐ŸŒˆ' -tag-template: 'v$NEXT_PATCH_VERSION' template: | ## Whatโ€™s Changed diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 000000000..57bc9c261 --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -0,0 +1,28 @@ +name: Publish to GitHub Packages + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+" + +jobs: + build: + runs-on: ubuntu-22.04 + permissions: + contents: write + packages: write + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Setup java + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - name: Publish package + run: ./gradlew publishAllPublicationsToGithubPackagesRepository + env: + ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ github.actor }} diff --git a/.github/workflows/update-release.yml b/.github/workflows/update-release.yml index f98cb29c5..07afea21d 100644 --- a/.github/workflows/update-release.yml +++ b/.github/workflows/update-release.yml @@ -2,13 +2,29 @@ name: Update release on: push: - branches: - - main + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+" jobs: update_draft_release: runs-on: ubuntu-latest steps: + - name: Detect unstable release + id: detect_unstable_release + run: | + set -ev + + stable_regex="^v[0-9]+\.[0-9]+\.[0-9]+$" + is_prerelease=$( if [[ ${{ github.ref_name }} =~ $stable_regex ]]; then echo "false"; else echo "true"; fi ) + + echo "IS_PRERELEASE=$is_prerelease" >> $GITHUB_OUTPUT - uses: release-drafter/release-drafter@v5 + with: + name: ${{ github.ref_name }} ๐ŸŒˆ + tag: ${{ github.ref_name }} + version: ${{ github.ref_name }} + prerelease: ${{ steps.detect_unstable_release.outputs.IS_PRERELEASE }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 12c6828d2..3db47f254 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ Make sure to read the [Contributing](CONTRIBUTING.md) page first though. ``` Copyright 2020 The Android Open Source Project +Copyright 2023 Yumemi, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle b/build.gradle index c1c80c0b7..509b9db06 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ /* * Copyright 2020 The Android Open Source Project + * Copyright 2023 Yumemi, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +38,8 @@ buildscript { plugins { id "com.diffplug.spotless" version "6.5.2" alias(libs.plugins.jetbrains.dokka) + + alias(libs.plugins.gitVersion) } apply plugin: 'com.dropbox.affectedmoduledetector' @@ -192,34 +195,35 @@ subprojects { } afterEvaluate { - def composeSnapshot = libs.versions.composesnapshot.get() - if (composeSnapshot.length() > 1) { - // We're depending on a Jetpack Compose snapshot, update the library version name - // to indicate it's from a Compose snapshot - def versionName = project.properties.get('VERSION_NAME') - if (versionName.contains("SNAPSHOT")) { - version = versionName.replace('-SNAPSHOT', ".compose-${composeSnapshot}-SNAPSHOT") + def hasMavenPublishPlugin = project.plugins.hasPlugin(libs.plugins.vanniktech.maven.publish.get().pluginId) + if (!hasMavenPublishPlugin) return + + // https://vanniktech.github.io/gradle-maven-publish-plugin/other/#github-packages-example + publishing { + repositories { + maven { + name = "githubPackages" + url = "https://maven.pkg.github.com/yumemi-inc/accompanist" + // username and password (a personal Github access token) should be specified as + // `githubPackagesUsername` and `githubPackagesPassword` Gradle properties or alternatively + // as `ORG_GRADLE_PROJECT_githubPackagesUsername` and `ORG_GRADLE_PROJECT_githubPackagesPassword` + // environment variables + credentials(PasswordCredentials) + } } } - - if (!version.endsWith('SNAPSHOT')) { - // If we're not a SNAPSHOT library version, we fail the build if we're relying on - // any snapshot dependencies - configurations.configureEach { configuration -> - configuration.dependencies.configureEach { dependency -> - if (dependency instanceof ProjectDependency) { - // We don't care about internal project dependencies - return - } - - def depVersion = dependency.version - if (depVersion != null && depVersion.endsWith('SNAPSHOT')) { - throw new IllegalArgumentException( - "Using SNAPSHOT dependency with non-SNAPSHOT library version: $dependency" - ) - } - } + mavenPublishing { + // https://github.com/palantir/gradle-git-version + def trimVersionPrefix = { String versionStr -> + versionStr.startsWith('v') ? versionStr - 'v' : versionStr } + def versionName = (gitVersion >> trimVersionPrefix)() + + coordinates( + project.properties.get('GROUP'), + project.properties.get('POM_ARTIFACT_ID'), + versionName, + ) } } } diff --git a/gradle.properties b/gradle.properties index 2b8ae2db7..dfa818317 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ # # Copyright 2020 The Android Open Source Project +# Copyright 2023 Yumemi, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ org.gradle.parallel=true android.useAndroidX=true # Increase memory -org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=2048m -XX:+HeapDumpOnOutOfMemoryError +org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=4096m -XX:+HeapDumpOnOutOfMemoryError # Required to publish to Nexus (see https://github.com/gradle/gradle/issues/11308) systemProp.org.gradle.internal.publish.checksums.insecure=true @@ -31,23 +32,19 @@ systemProp.org.gradle.internal.publish.checksums.insecure=true # Increase timeout when pushing to Sonatype (otherwise we get timeouts) systemProp.org.gradle.internal.http.socketTimeout=120000 -GROUP=com.google.accompanist -# !! No longer need to update this manually when using a Compose SNAPSHOT -VERSION_NAME=0.33.3-SNAPSHOT +GROUP=jp.co.yumemi.compose.accompanist POM_DESCRIPTION=Utilities for Jetpack Compose -POM_URL=https://github.com/google/accompanist/ -POM_SCM_URL=https://github.com/google/accompanist/ -POM_SCM_CONNECTION=scm:git:git://github.com/google/accompanist.git -POM_SCM_DEV_CONNECTION=scm:git:git://github.com/google/accompanist.git +POM_URL=https://github.com/yumemi-inc/accompanist +POM_SCM_URL=https://github.com/yumemi-inc/accompanist +POM_SCM_CONNECTION=scm:git:git://github.com/yumemi-inc/accompanist.git +POM_SCM_DEV_CONNECTION=scm:git:git://github.com/yumemi-inc/accompanist.git POM_LICENCE_NAME=The Apache Software License, Version 2.0 POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo -POM_DEVELOPER_ID=google -POM_DEVELOPER_NAME=Google - -SONATYPE_HOST=DEFAULT -RELEASE_SIGNING_ENABLED=true +POM_DEVELOPER_ID=yumemi-inc +POM_DEVELOPER_NAME=YUMEMI Inc. +POM_DEVELOPER_URL=https://github.com/yumemi-inc/ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eddac9fc8..c58dab274 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -25,6 +25,10 @@ androidxWindow = "1.0.0" metalava = "0.3.2" vanniktechPublish = "0.25.2" +# plugin +# https://github.com/palantir/gradle-git-version +gitVersion = "3.0.0" + [libraries] compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } compose-ui-util = { module = "androidx.compose.ui:ui-util", version.ref = "compose" } @@ -112,3 +116,5 @@ android-lint = { id = "com.android.lint", version.ref = "androidlint"} jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } gradle-metalava = { id = "me.tylerbwong.gradle.metalava", version.ref = "metalava" } vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktechPublish" } + +gitVersion = { id = "com.palantir.git-version", version.ref = "gitVersion" }