-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 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,88 @@ | ||
# Manual publish workflow that publishes a library version from any branch with the specified version | ||
name: publish-manual | ||
run-name: "Manual publish" | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to publish' | ||
required: true | ||
jobs: | ||
build-app: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
runs-on: "ubuntu-latest" | ||
env: | ||
BUILD_NUMBER: ${{ github.run_number }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: temurin | ||
cache: gradle | ||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc | ||
- name: Validate Gradle Wrapper | ||
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 | ||
- run: "./bump_version.sh ${{ github.event.inputs.version }}" | ||
- run: "v=$(cat version.txt);echo \"VERSION=$v\" > $GITHUB_ENV" | ||
- run: "echo \"# Release version ${{ env.VERSION }}\" > $GITHUB_STEP_SUMMARY" | ||
- name: Compile library | ||
run: "./gradlew --parallel assemble :kotlinova-gradle:jar" | ||
- name: Compile Unit Tests | ||
# We cannot run instrumented tests on CI, but at least we can compile them to ensure | ||
# that anvil build passes. | ||
run: "./gradlew --parallel jvmTestClasses compileDebugUnitTestKotlinAndroid compileReleaseUnitTestKotlinAndroid assembleAndroidTest testClasses" | ||
- name: Lint | ||
run: "./gradlew --continue --parallel buildSrc:detekt detektMetadataMain detektJvmMain detektAndroidDebug detektAndroidRelease detektJvmTest :kotlinova-gradle:detektMain lint" | ||
- name: Run Unit Tests | ||
run: "./gradlew test jvmTest" | ||
- name: 'Save GPG key' | ||
run: 'echo "${{ secrets.GPG_SIGNING_KEY }}" | base64 -d > signing_key.gpg' | ||
- id: create_staging_repository | ||
name: "Create nexus staging repository" | ||
uses: nexus-actions/create-nexus-staging-repo@v1.2 | ||
with: | ||
# The username you use to connect to Sonatype's Jira | ||
username: ${{ secrets.OSSRH_USERNAME }} | ||
password: ${{ secrets.OSSRH_PASSWORD }} | ||
# Your staging profile ID. You can get it at https://oss.sonatype.org/#stagingProfiles;$staginProfileId | ||
staging_profile_id: ${{ secrets.OSSRH_STAGING_PROFILE_ID }} | ||
# a description to identify your repository in the UI | ||
description: Created by Automatic Github flow | ||
- name: 'Publish' | ||
run: './gradlew publish :kotlinova-gradle:publish | ||
-PossrhUsername=''${{ secrets.OSSRH_USERNAME }}'' | ||
-PossrhPassword=''${{ secrets.OSSRH_PASSWORD }}'' | ||
-PossrhRepId=''${{ steps.create_staging_repository.outputs.repository_id }}'' | ||
-Psigning.secretKeyRingFile=$(pwd)/signing_key.gpg | ||
-Psigning.password=''${{ secrets.GPG_SIGNING_PASSPHRASE }}'' | ||
-Psigning.keyId=${{ secrets.GPG_SIGNING_ID }}' | ||
- name: 'Release staging repository' | ||
run: './gradlew closeAndReleaseRepository | ||
-PossrhRepId=''${{ steps.create_staging_repository.outputs.repository_id }}'' | ||
-PossrhUsername=''${{ secrets.OSSRH_USERNAME }}'' | ||
-PossrhPassword=''${{ secrets.OSSRH_PASSWORD }}''' | ||
- name: Discard nexus staging repository | ||
if: ${{ failure() && steps.create_staging_repository.outputs.repository_id != null }} | ||
uses: nexus-actions/drop-nexus-staging-repo@v1 | ||
with: | ||
username: ${{ secrets.SONATYPE_USERNAME }} | ||
password: ${{ secrets.SONATYPE_PASSWORD }} | ||
staging_repository_id: ${{ steps.create_staging_repository.outputs.repository_id }} | ||
- name: 'Create tag' | ||
run: 'git tag ${{ env.VERSION }}' | ||
- name: 'Push tag' | ||
run: 'git push origin ${{ env.VERSION }}' | ||
- name: Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action/composite@v2 | ||
if: always() | ||
with: | ||
comment_mode: failures | ||
junit_files: | | ||
**/build/outputs/*-results/**/*.xml | ||
**/build/*-results/**/*.xml |