|
7 | 7 | branches: [ master ]
|
8 | 8 |
|
9 | 9 | jobs:
|
| 10 | + resolve-version: |
| 11 | + uses: ./.github/workflows/resolve-version.yml |
| 12 | + needs: [ check ] |
| 13 | + with: |
| 14 | + desired-version: ${{ github.event.release.tag_name || github.event.inputs.version }} |
| 15 | + |
10 | 16 | publish-snapshot:
|
11 |
| - runs-on: ${{ matrix.os }} |
| 17 | + needs: |
| 18 | + - resolve-version |
| 19 | + runs-on: ${{ matrix.os.runner }} |
| 20 | + defaults: |
| 21 | + run: |
| 22 | + shell: ${{ matrix.os.shell }} |
| 23 | + env: |
| 24 | + VERSION: ${{ needs.resolve-version.outputs.version }} |
| 25 | + GH_USERNAME: ${{ github.actor }} |
| 26 | + GH_PASSWORD: ${{ github.token }} |
| 27 | + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET }} |
| 28 | + ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }} |
| 29 | + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }} |
| 30 | + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} |
| 31 | + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} |
12 | 32 | strategy:
|
13 | 33 | matrix:
|
14 |
| - os: [macos-latest, windows-latest, ubuntu-latest] |
| 34 | + repository: |
| 35 | + - name: Github Packages |
| 36 | + tasks: publishAllPublicationsToGitHubRepository |
| 37 | + enabled: ${{ github.event.inputs.skipGitHub != 'y' }} |
| 38 | + - name: Maven Central |
| 39 | + # `closeSonatypeStagingRepository` Requires to manually release a new version on https://s01.oss.sonatype.org/#stagingRepositories |
| 40 | + # If you're brave, you could change it to `closeAndReleaseSonatypeStagingRepository` to fully automate the release |
| 41 | + tasks: publishToSonatype closeAndReleaseSonatypeStagingRepository |
| 42 | + enabled: ${{ github.event.inputs.skipMavenCentral != 'y' }} |
| 43 | + os: |
| 44 | + - runner: macos-latest |
| 45 | + shell: bash |
| 46 | + - runner: windows-latest |
| 47 | + shell: msys2 {0} |
| 48 | + - runner: ubuntu-latest |
| 49 | + shell: bash |
15 | 50 |
|
16 | 51 | steps:
|
17 |
| - - uses: actions/checkout@v2 |
18 |
| - |
19 |
| - - name: Publish Snapshot |
20 |
| - env: |
21 |
| - SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} |
22 |
| - SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} |
23 |
| - GPG_SECRET: ${{ secrets.GPG_SECRET }} |
24 |
| - GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} |
25 |
| - SNAPSHOT: 'TRUE' |
26 |
| - run: ./gradlew publish |
27 |
| - |
28 |
| - - name: Archive redux-kotlin publications dir |
29 |
| - uses: actions/upload-artifact@v1 |
30 |
| - with: |
31 |
| - name: publications-${{ matrix.os }} |
32 |
| - path: redux-kotlin/build/publications |
33 |
| - |
34 |
| - - name: Archive redux-kotlin-threadsafe publications dir |
35 |
| - if: steps.publish.outputsexit_code == 0 |
36 |
| - uses: actions/upload-artifact@v1 |
37 |
| - with: |
38 |
| - name: publications-threadsafe-${{ matrix.os }} |
39 |
| - path: redux-kotlin-threadsafe/build/publications |
| 52 | + steps: |
| 53 | + - uses: msys2/setup-msys2@v2 |
| 54 | + if: ${{ matrix.repository.enabled == true && runner.os == 'Windows' }} |
| 55 | + with: |
| 56 | + release: false |
| 57 | + msystem: MINGW64 |
| 58 | + update: true |
| 59 | + path-type: inherit |
| 60 | + install: >- |
| 61 | + mingw-w64-x86_64-curl |
| 62 | + curl |
| 63 | +
|
| 64 | + - uses: actions/checkout@v3 |
| 65 | + if: ${{ matrix.repository.enabled == true }} |
| 66 | + |
| 67 | + - uses: actions/setup-java@v3 |
| 68 | + if: ${{ matrix.repository.enabled == true }} |
| 69 | + with: |
| 70 | + distribution: 'adopt' |
| 71 | + java-version: 11 |
| 72 | + |
| 73 | + - name: Restore Gradle cache |
| 74 | + if: ${{ matrix.repository.enabled == true }} |
| 75 | + id: cache-gradle |
| 76 | + uses: actions/cache@v3 |
| 77 | + with: |
| 78 | + path: | |
| 79 | + ~/.gradle/caches |
| 80 | + ~/.gradle/wrapper |
| 81 | + ~/.gradle/yarn |
| 82 | + ~/.gradle/nodejs |
| 83 | + ~/.konan |
| 84 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 85 | + restore-keys: ${{ runner.os }}-gradle- |
| 86 | + |
| 87 | + - name: Gradle Publish to ${{ matrix.repository.name }} |
| 88 | + if: ${{ matrix.repository.enabled == true }} |
| 89 | + run: ./gradlew ${{ matrix.repository.tasks }} -Pversion=${VERSION//v} --scan |
| 90 | + |
| 91 | + - name: Archive redux-kotlin publications dir |
| 92 | + uses: actions/upload-artifact@v1 |
| 93 | + with: |
| 94 | + name: publications-${{ matrix.os }} |
| 95 | + path: redux-kotlin/build/publications |
| 96 | + |
| 97 | + - name: Archive redux-kotlin-threadsafe publications dir |
| 98 | + if: steps.publish.outputsexit_code == 0 |
| 99 | + uses: actions/upload-artifact@v1 |
| 100 | + with: |
| 101 | + name: publications-threadsafe-${{ matrix.os }} |
| 102 | + path: redux-kotlin-threadsafe/build/publications |
40 | 103 |
|
0 commit comments