diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..44ad9c38 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup JDK + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "lts/*" + - name: Make gradlew executable + run: chmod +x gradlew + - name: Build with Gradle + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew build + - name: Setup semantic-release + run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release diff --git a/.releaserc b/.releaserc new file mode 100644 index 00000000..ab20d0ca --- /dev/null +++ b/.releaserc @@ -0,0 +1,25 @@ +{ + "branches": [ + "main", + { + "name": "dev", + "prerelease": true + } + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + "gradle-semantic-release-plugin", + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "gradle.properties" + ] + } + ], + "@semantic-release/github" + ] +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index a7b5c335..389b0f83 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,8 @@ plugins { kotlin("jvm") version "1.6.20" id("com.github.johnrengelman.shadow") version "7.1.2" + java + `maven-publish` } group = "app.revanced" @@ -12,7 +14,7 @@ repositories { url = uri("https://maven.pkg.github.com/revanced/multidexlib2") credentials { username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") // DO NOT CHANGE! - password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") // DO NOT CHANGE! + password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") // DO NOT CHANGE! } } maven { @@ -33,6 +35,11 @@ dependencies { implementation("org.bouncycastle:bcpkix-jdk15on:+") } +java { + withSourcesJar() + withJavadocJar() +} + tasks { build { dependsOn(shadowJar) @@ -48,3 +55,21 @@ tasks { } } } + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/revanced/revanced-cli") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } + publications { + register("gpr") { + from(components["java"]) + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index e2e428ad..23ae36a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ kotlin.code.style=official -version = 1.0.0-dev \ No newline at end of file +version=1.0.0 \ No newline at end of file