New release process #71
Workflow file for this run
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
name: "Build Test and Deploy" | |
on: | |
pull_request: | |
paths-ignore: | |
- '*.md' | |
types: | |
- synchronize | |
- opened | |
jobs: | |
create-staging-repository: | |
name: Create staging repository | |
runs-on: ubuntu-latest | |
outputs: | |
repository_id: ${{ steps.create.outputs.repository_id }} | |
steps: | |
- id: create | |
uses: nexus-actions/[email protected] | |
with: | |
username: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }} | |
base_url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' | |
description: Created by $GITHUB_WORKFLOW ($GITHUB_ACTION) for $GITHUB_REPOSITORY | |
macos: | |
needs: create-staging-repository | |
runs-on: macOS-latest | |
env: | |
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 19 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '19' | |
cache: gradle | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Import GPG Key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_SECRET }} | |
passphrase: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
- name: Test and deploy with Gradle | |
env: | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: ./gradlew publishAllPublicationsToSonatypeRepository | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Package | |
path: build/libs | |
finalize: | |
runs-on: ubuntu-latest | |
needs: [create-staging-repository, macos] | |
if: ${{ always() && needs.create_staging_repository.result == 'success' }} | |
steps: | |
- name: Discard | |
if: ${{ needs.macos.result != 'success' }} | |
uses: nexus-actions/[email protected] | |
with: | |
username: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository-id }} | |
- name: Release | |
if: ${{ needs.macos.result == 'success' }} | |
uses: nexus-actions/[email protected] | |
with: | |
username: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }} | |
close_only: true |