-
Notifications
You must be signed in to change notification settings - Fork 30
89 lines (87 loc) · 3.96 KB
/
deploy-to-packages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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 --info
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 }}