|
12 | 12 | branches: [master]
|
13 | 13 | push:
|
14 | 14 | branches: [master]
|
| 15 | + tags: [v*] |
15 | 16 |
|
16 | 17 | env:
|
17 | 18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
55 | 56 |
|
56 | 57 | - name: Build project
|
57 | 58 | run: sbt ++${{ matrix.scala }} test
|
| 59 | + |
| 60 | + - name: Compress target directories |
| 61 | + run: tar cf targets.tar target project/target |
| 62 | + |
| 63 | + - name: Upload target directories |
| 64 | + uses: actions/upload-artifact@v2 |
| 65 | + with: |
| 66 | + name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }} |
| 67 | + path: targets.tar |
| 68 | + |
| 69 | + publish: |
| 70 | + name: Publish Artifacts |
| 71 | + needs: [build] |
| 72 | + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) |
| 73 | + strategy: |
| 74 | + matrix: |
| 75 | + os: [ubuntu-latest] |
| 76 | + scala: [2.12.15] |
| 77 | + java: [temurin@8] |
| 78 | + runs-on: ${{ matrix.os }} |
| 79 | + steps: |
| 80 | + - name: Checkout current branch (full) |
| 81 | + uses: actions/checkout@v2 |
| 82 | + with: |
| 83 | + fetch-depth: 0 |
| 84 | + |
| 85 | + - name: Setup Java (temurin@8) |
| 86 | + if: matrix.java == 'temurin@8' |
| 87 | + uses: actions/setup-java@v2 |
| 88 | + with: |
| 89 | + distribution: temurin |
| 90 | + java-version: 8 |
| 91 | + |
| 92 | + - name: Cache sbt |
| 93 | + uses: actions/cache@v2 |
| 94 | + with: |
| 95 | + path: | |
| 96 | + ~/.sbt |
| 97 | + ~/.ivy2/cache |
| 98 | + ~/.coursier/cache/v1 |
| 99 | + ~/.cache/coursier/v1 |
| 100 | + ~/AppData/Local/Coursier/Cache/v1 |
| 101 | + ~/Library/Caches/Coursier/v1 |
| 102 | + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} |
| 103 | + |
| 104 | + - name: Download target directories (2.12.15) |
| 105 | + uses: actions/download-artifact@v2 |
| 106 | + with: |
| 107 | + name: target-${{ matrix.os }}-2.12.15-${{ matrix.java }} |
| 108 | + |
| 109 | + - name: Inflate target directories (2.12.15) |
| 110 | + run: | |
| 111 | + tar xf targets.tar |
| 112 | + rm targets.tar |
| 113 | +
|
| 114 | + - env: |
| 115 | + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} |
| 116 | + PGP_SECRET: ${{ secrets.PGP_SECRET }} |
| 117 | + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} |
| 118 | + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} |
| 119 | + run: sbt ++${{ matrix.scala }} ci-release |
0 commit comments