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
56 changes: 48 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
TEST_JAVA_VERSION: '21'

# Stages: Resolve Version -> Test (lowest and latest Android SDK) -> Build library & sample app -> Tag & Release
# -> Publish to GitHub Packages and Maven Central
# -> Publish to GitHub Packages and Maven Central, Javadoc to GitHub Pages
# The Test report job publishes the JUnit results of every SDK, also when the tests fail.
# Every stage must succeed for the next one to start.
jobs:
Expand Down Expand Up @@ -182,14 +182,17 @@ jobs:
./gradlew \
:flowlayoutmanager:assembleRelease \
:flowlayoutmanager:publishToMavenLocal \
:flowlayoutmanager:publishReleasePublicationToStagingRepository \
:flowlayoutmanager:publishReleasePublicationToCentralRepository \
:flowlayoutmanager:publishGithubPublicationToGithubRepository \
:app:assembleDebug \
:app:assembleRelease

- name: Package
run: |
mkdir -p dist
cp flowlayoutmanager/build/outputs/aar/flowlayoutmanager-release.aar "dist/FlowLayoutManager-${VERSION}.aar"
cp "flowlayoutmanager/build/staging-deploy/central/io/github/simonebortolin/FlowLayoutManager/${VERSION}/FlowLayoutManager-${VERSION}-javadoc.jar" \
"dist/FlowLayoutManager-${VERSION}-javadoc.jar"

# Signed release APK when a keystore is configured, debug APK otherwise
# (an unsigned APK cannot be installed).
Expand All @@ -209,8 +212,8 @@ jobs:
path: dist/*
if-no-files-found: error

# Maven repository layout (AAR, sources, javadoc, POM and signatures),
# published as is to GitHub Packages and Maven Central
# Maven repository layouts (AAR, sources, javadoc, POM and signatures),
# published as is to Maven Central (central/) and GitHub Packages (github/)
- name: Upload Maven artifacts
uses: actions/upload-artifact@v7
with:
Expand Down Expand Up @@ -255,7 +258,7 @@ jobs:
- name: Attest build provenance
uses: actions/attest-build-provenance@v4
with:
subject-path: 'release/*.aar, release/*.apk, maven/**/*.aar, maven/**/*.jar, maven/**/*.pom'
subject-path: 'release/*.aar, release/*.jar, release/*.apk, maven/**/*.aar, maven/**/*.jar, maven/**/*.pom'

- name: Tag release
id: tag
Expand Down Expand Up @@ -296,6 +299,43 @@ jobs:
-f description="$DESCRIPTION" \
-f context="release"

pages:
name: Publish Javadoc to GitHub Pages
runs-on: ubuntu-latest
needs: [version, release]
if: needs.version.outputs.tag_exists != 'true'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
env:
VERSION: ${{ needs.version.outputs.version }}

steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: flowlayoutmanager-${{ env.VERSION }}
path: release

# Same Javadoc jar shipped with the release and on Maven Central
- name: Extract Javadoc
run: |
mkdir site
unzip -q "release/FlowLayoutManager-${VERSION}-javadoc.jar" -d site
rm -rf site/META-INF

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: site

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

publish-github:
name: Publish to GitHub Packages
runs-on: ubuntu-latest
Expand All @@ -319,7 +359,7 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd maven
cd maven/github
{ find . -type f ! -name 'maven-metadata.xml*' | sort; find . -type f -name 'maven-metadata.xml*' | sort; } > "$RUNNER_TEMP/files"
while read -r FILE; do
echo "Uploading ${FILE#./}"
Expand Down Expand Up @@ -351,13 +391,13 @@ jobs:
echo "::warning::MAVEN_CENTRAL_USERNAME and MAVEN_CENTRAL_PASSWORD not configured - skip Maven Central"
exit 0
fi
if ! find maven -name '*.asc' | grep -q .; then
if ! find maven/central -name '*.asc' | grep -q .; then
echo "::error::Maven artifacts are not signed - configure SIGNING_KEY and SIGNING_PASSWORD"
exit 1
fi

# Maven Central manages maven-metadata.xml itself
(cd maven && zip -qr "$RUNNER_TEMP/bundle.zip" . -x '*maven-metadata.xml*')
(cd maven/central && zip -qr "$RUNNER_TEMP/bundle.zip" . -x '*maven-metadata.xml*')
AUTH="Authorization: Bearer $(printf '%s:%s' "$CENTRAL_USERNAME" "$CENTRAL_PASSWORD" | base64 -w0)"
DEPLOYMENT=$(curl --fail-with-body -sS -H "$AUTH" -F "bundle=@$RUNNER_TEMP/bundle.zip" \
"https://central.sonatype.com/api/v1/publisher/upload?name=${{ github.event.repository.name }}-$VERSION&publishingType=AUTOMATIC")
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ The library is published on Maven Central, add the dependency (remember to check

```groovy
dependencies {
implementation 'io.github.simonebortolin:FlowLayoutManager:1.10.0'
implementation 'io.github.simonebortolin:FlowLayoutManager:1.10.1'
}
```

It is also available on [JitPack](https://jitpack.io/#simonebortolin/FlowLayoutManager) as `com.github.simonebortolin:FlowLayoutManager`
(add `maven { url "https://jitpack.io" }` to the repositories in `settings.gradle`) and on
[GitHub Packages](https://github.com/simonebortolin/FlowLayoutManager/packages), which requires a GitHub token to download.
[GitHub Packages](https://github.com/simonebortolin/FlowLayoutManager/packages) as `io.github.simonebortolin:flowlayoutmanager`, which requires a GitHub token to download.

Every release also ships the `.aar` and the sample app `.apk`, with their build provenance attestation,
The Javadoc of the latest release is on [GitHub Pages](https://simonebortolin.github.io/FlowLayoutManager/).

Every release also ships the `.aar`, the Javadoc `.jar` and the sample app `.apk`, with their build provenance attestation,
on the [Releases page](https://github.com/simonebortolin/FlowLayoutManager/releases).

Item per line limitation
Expand Down
62 changes: 35 additions & 27 deletions flowlayoutmanager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,54 @@ dependencies {
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
artifactId = 'FlowLayoutManager'
// Same library, GitHub Packages does not accept uppercase letters in the artifactId
[release: 'FlowLayoutManager', github: 'flowlayoutmanager'].each { publicationName, publicationArtifactId ->
create(publicationName, MavenPublication) {
from components.release
artifactId = publicationArtifactId

// Metadata required by Maven Central
pom {
name = 'FlowLayoutManager'
description = 'A RecyclerView LayoutManager that lays out views in flow style.'
url = 'https://github.com/simonebortolin/FlowLayoutManager'
licenses {
license {
name = 'GNU General Public License v3.0'
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
// Metadata required by Maven Central
pom {
name = 'FlowLayoutManager'
description = 'A RecyclerView LayoutManager that lays out views in flow style.'
url = 'https://github.com/simonebortolin/FlowLayoutManager'
licenses {
license {
name = 'GNU General Public License v3.0'
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
}
}
}
developers {
developer {
id = 'simonebortolin'
name = 'Simone Bortolin'
url = 'https://github.com/simonebortolin'
developers {
developer {
id = 'simonebortolin'
name = 'Simone Bortolin'
url = 'https://github.com/simonebortolin'
}
}
scm {
url = 'https://github.com/simonebortolin/FlowLayoutManager'
connection = 'scm:git:https://github.com/simonebortolin/FlowLayoutManager.git'
developerConnection = 'scm:git:ssh://git@github.com/simonebortolin/FlowLayoutManager.git'
}
}
scm {
url = 'https://github.com/simonebortolin/FlowLayoutManager'
connection = 'scm:git:https://github.com/simonebortolin/FlowLayoutManager.git'
developerConnection = 'scm:git:ssh://git@github.com/simonebortolin/FlowLayoutManager.git'
}
}
}
}
repositories {
// Maven layout that CI uploads to GitHub Packages and Maven Central
// Maven layouts that CI uploads to Maven Central and GitHub Packages
maven {
name = 'central'
url = layout.buildDirectory.dir('staging-deploy/central')
}
maven {
name = 'staging'
url = layout.buildDirectory.dir('staging-deploy')
name = 'github'
url = layout.buildDirectory.dir('staging-deploy/github')
}
}
}

// Signed only when CI provides the key (ORG_GRADLE_PROJECT_signingKey and signingPassword)
// Signed only when CI provides the key (ORG_GRADLE_PROJECT_signingKey and signingPassword),
// GitHub Packages does not need the signatures
def signingKey = findProperty('signingKey')
if (signingKey) {
signing {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Version of the library and of the sample app, used by CI to tag and release.
VERSION_NAME=1.10.0
VERSION_CODE=20
VERSION_NAME=1.10.1
VERSION_CODE=21
# Keep it as low as the dependencies allow, library and sample app share it.
MIN_SDK=21

Expand Down
Loading