Skip to content

Based on pull request #206 implement default encodings. Note that #185

Based on pull request #206 implement default encodings. Note that

Based on pull request #206 implement default encodings. Note that #185

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.2
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 ]
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- name: Cached konan
uses: actions/cache@v3.2.5
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@v3.13.0
with:
java-version: '11'
distribution: 'temurin'
- id: cache-gradle-windows
name: Set up gradle
uses: gradle/gradle-build-action@v2.9.0
- name: Check (macos / windows)
if: matrix.os != 'ubuntu-latest'
run: ./gradlew nativeTest --stacktrace
shell: bash
- name: Upload (macos / windows)
if: matrix.os != 'ubuntu-latest'
run: ./gradlew publishNative -Pxmlutil.repositoryId='${{ needs.create-staging-repository.outputs.repository_id }}' -Possrh.username='${{ secrets.OSSRH_USERNAME }}' -Possrh.password='${{ secrets.OSSRH_PASSWORD }}' -Pnative.deploy=host --stacktrace
shell: bash
# Linux / JVM / JS
- name: Check (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew check --stacktrace
shell: bash
- name: Store reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: reports
path: |
**/build/reports/
**/build/test-results/
- name: Upload (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./gradlew 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 }}