forked from pdvrieze/xmlutil
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (85 loc) · 3.95 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
name: Create and publish a package
on:
release:
types: [ created ]
push:
branches:
- 'dev'
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/[email protected]
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@v2
- name: Cached konan
uses: actions/cache@v2
with:
path: ~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- id: cache-gradle-windows
name: Cache gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{runner.os}}-build-gradle-${{ hashFiles('gradle.properties', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- 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: 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 }}