Create and publish a package #213
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: Create and publish a package | |
on: | |
push: | |
branches: | |
- 'dev' | |
tags: | |
- 'v[0-9]*' | |
workflow_dispatch: | |
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/create-nexus-staging-repo@v1.3.0 | |
with: | |
username: ${{ secrets.OSSRH_USERNAME }} | |
password: ${{ secrets.OSSRH_PASSWORD }} | |
base_url: https://s01.oss.sonatype.org/service/local/ | |
staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }} | |
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }} | |
build-and-publish: | |
needs: create-staging-repository | |
runs-on: ${{ matrix.os }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_PRIV_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} | |
strategy: | |
matrix: | |
# os: [ macOs-latest, windows-latest, ubuntu-latest ] | |
os: [ macOs-latest ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.6 | |
- name: Cached konan | |
uses: actions/cache@v4.0.2 | |
with: | |
path: ~/.konan | |
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-konan- | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4.2.1 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- id: cache-gradle-windows | |
name: Set up gradle | |
uses: gradle/actions/setup-gradle@v3.3.2 | |
- name: Check (macos / windows) | |
if: matrix.os != 'ubuntu-latest' | |
run: ./gradlew -PexcludeSchema nativeTest --stacktrace | |
shell: bash | |
- name: Check (ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: ./gradlew -PexcludeSchema check --stacktrace | |
shell: bash | |
- name: Store reports | |
if: failure() | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: reports | |
path: | | |
**/build/reports/ | |
**/build/test-results/ | |
- name: Upload (macOs) | |
if: matrix.os == 'macOs-latest' | |
run: ./gradlew -PexcludeSchema publish -Pxmlutil.repositoryId='${{ needs.create-staging-repository.outputs.repository_id }}' -Possrh.username='${{ secrets.OSSRH_USERNAME }}' -Possrh.password='${{ secrets.OSSRH_PASSWORD }}' -Pnative.deploy=all --stacktrace | |
shell: bash | |
drop-on-failure: | |
needs: [ create-staging-repository, build-and-publish ] | |
runs-on: ubuntu-latest | |
if: ${{ always() && needs.create_staging_repository.result == 'success' }} | |
steps: | |
- name: Discard | |
if: ${{ needs.build-and-publish != 'success' }} | |
uses: nexus-actions/drop-nexus-staging-repo@v1 | |
with: | |
username: ${{ secrets.OSSRH_USERNAME }} | |
password: ${{ secrets.OSSRH_PASSWORD }} | |
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }} |