Skip to content

Commit

Permalink
(feat) publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-pelykh committed Nov 18, 2024
1 parent 87cf7e2 commit cf8e377
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 10 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:

package:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Set up Git Hub Pages
uses: actions/configure-pages@v5

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

- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
packages: ndk-bundle ndk;27.2.12479018

- name: Build artifacts
run: ./gradlew :lib:assembleRelease

- name: Build docs
run: |
sudo apt-get install -y pandoc
mkdir -p build/gh-pages
pandoc \
-f gfm -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua -H gh-pages/header.html \
-o build/gh-pages/index.html README.md
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/gh-pages

- name: Publish artifacts
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
env:
# GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
# GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
run: ./gradlew publish -Puvccamera.version=${{ github.ref_name }}-SNAPSHOT

publish-github-pages:
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}

runs-on: ubuntu-latest

permissions:
contents: read
pages: write
id-token: write

needs:
- package

environment:
name: github-pages
url: ${{ steps.publish-github-pages.outputs.page_url }}

steps:
- name: Set up Git Hub Pages
uses: actions/configure-pages@v5

- name: Publish GitHub Pages
id: publish-github-pages
uses: actions/deploy-pages@v4
50 changes: 50 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
package:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

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

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

- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
packages: ndk-bundle ndk;27.2.12479018

- name: Build artifacts
run: ./gradlew :lib:assembleRelease

- name: Publish artifacts
env:
# GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
# GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
run: ./gradlew publish -Puvccamera.version=${{ github.ref_name }}
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
# UVCCamera

![GitHub Repo stars](https://img.shields.io/github/stars/alexey-pelykh/UVCCamera?style=flat&logo=github)
![GitHub License](https://img.shields.io/github/license/alexey-pelykh/UVCCamera)
[![GitHub Repo stars](https://img.shields.io/github/stars/alexey-pelykh/UVCCamera?style=flat&logo=github)](https://github.com/alexey-pelykh/UVCCamera)
[![GitHub License](https://img.shields.io/github/license/alexey-pelykh/UVCCamera)](./LICENSE.md)
[![Maven Central Version](https://img.shields.io/maven-central/v/org.uvccamera/lib)](https://mvnrepository.com/artifact/org.uvccamera/lib)

This project is a hard fork of the original [UVCCamera by saki4510t](https://github.com/saki4510t/UVCCamera) and is
brought to you by [Alexey Pelykh](https://github.com/alexey-pelykh) with a great gratitude to the original project's
author [saki4510t](https://github.com/saki4510t/) and its community of contributors. It includes some improvements from
the original project's forks and PRs.

## Usage

The library is available on Maven Central. To use it in your project, add the following dependency:

either to your `build.gradle` file in the `dependencies` block:

```groovy
implementation 'org.uvccamera:lib:0.1.0'
```

or to your `build.gradle.kts` file in the `dependencies` block:

```kotlin
implementation("org.uvccamera:lib:0.1.0")
```

## License

The original license applies to the relevant parts of this project as well:
Expand Down
90 changes: 90 additions & 0 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
plugins {
alias(libs.plugins.android.library)
`maven-publish`
signing
}

version = findProperty("uvccamera.version") as String? ?: "0.0.0-SNAPSHOT"

android {
namespace = "com.serenegiant.uvccamera"
compileSdk = 34
Expand All @@ -23,15 +27,24 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}

externalNativeBuild {
ndkBuild {
path = file("src/main/cpp/Android.mk")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

dependencies {
Expand All @@ -40,3 +53,80 @@ dependencies {
androidTestImplementation(libs.support.test.runner)
androidTestImplementation(libs.support.espresso.core)
}

publishing {
publications {
create<MavenPublication>("release") {
afterEvaluate {
from(components["release"])
}

groupId = "org.uvccamera"
artifactId = project.name
version = project.version.toString()

pom {
name = "org.uvccamera:${project.name}"
description = "UVC Camera Library"
url = "https://uvccamera.org"

licenses {
license {
name = "Apache License Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
name = "saki"
email = "t_saki@serenegiant.com"
}
developer {
name = "Alexey Pelykh"
email = "alexey.pelykh@gmail.com"
organization = "The UVCCamera Project"
organizationUrl = "https://uvccamera.org"
}
}
scm {
connection = "scm:git:git://github.com/alexey-pelykh/UVCCamera.git"
developerConnection = "scm:git:ssh://github.com:alexey-pelykh/UVCCamera.git"
url = "https://github.com/alexey-pelykh/UVCCamera"
}
}
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY"))
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}

maven {
name = "OSSRH"
url = uri(
if (project.version.toString().endsWith("-SNAPSHOT"))
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
else
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
)
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_TOKEN")
}
}
}
}

signing {
useInMemoryPgpKeys(
System.getenv("GPG_PRIVATE_KEY"),
System.getenv("GPG_PASSPHRASE")
)
sign(publishing.publications["release"])
}
4 changes: 2 additions & 2 deletions lib/src/main/cpp/Android.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include $(call all-subdir-makefiles)
PROJ_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(PROJ_PATH)/UVCCamera/Android.mk
include $(PROJ_PATH)/libjpeg-turbo-1.5.0/Android.mk
include $(PROJ_PATH)/libusb/android/jni/Android.mk
include $(PROJ_PATH)/libuvc/android/jni/Android.mk
include $(PROJ_PATH)/libuvc/android/jni/Android.mk
include $(PROJ_PATH)/UVCCamera/Android.mk
12 changes: 6 additions & 6 deletions lib/src/main/cpp/Application.mk
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#/*
# * UVCCamera
# * library and sample to access to UVC web camera on non-rooted Android device
# *
# *
# * Copyright (c) 2014-2017 saki t_saki@serenegiant.com
# *
# *
# * File name: Application.mk
# *
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of the License at
# *
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *
# *
# * All files in the folder are under this Apache License, Version 2.0.
# * Files in the jni/libjpeg, jni/libusb, jin/libuvc, jni/rapidjson folder may have a different license, see the respective files.
#*/
Expand Down

0 comments on commit cf8e377

Please sign in to comment.