|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: ['**'] |
| 5 | + push: |
| 6 | + branches: ['**'] |
| 7 | + tags: [v*] |
| 8 | +jobs: |
| 9 | + ci: |
| 10 | + # run on external PRs, but not on internal PRs since those will be run by push to branch |
| 11 | + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository |
| 12 | + runs-on: ubuntu-20.04 |
| 13 | + env: |
| 14 | + JAVA_OPTS: -Xmx4G |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v2 |
| 18 | + - name: Set up JDK 11 |
| 19 | + uses: actions/setup-java@v1 |
| 20 | + with: |
| 21 | + java-version: 11 |
| 22 | + - name: Cache sbt |
| 23 | + uses: actions/cache@v2 |
| 24 | + with: |
| 25 | + path: | |
| 26 | + ~/.sbt |
| 27 | + ~/.ivy2/cache |
| 28 | + ~/.coursier |
| 29 | + key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }} |
| 30 | + - name: Compile |
| 31 | + run: sbt -v compile |
| 32 | + - name: Test |
| 33 | + run: sbt -v test |
| 34 | + - name: Cleanup |
| 35 | + run: | |
| 36 | + rm -rf "$HOME/.ivy2/local" || true |
| 37 | + find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true |
| 38 | + find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true |
| 39 | + find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true |
| 40 | + find $HOME/.sbt -name "*.lock" -delete || true |
| 41 | +
|
| 42 | + publish: |
| 43 | + name: Publish release |
| 44 | + needs: [ci] |
| 45 | + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) |
| 46 | + runs-on: ubuntu-20.04 |
| 47 | + env: |
| 48 | + JAVA_OPTS: -Xmx4G |
| 49 | + steps: |
| 50 | + - name: Checkout |
| 51 | + uses: actions/checkout@v2 |
| 52 | + - name: Set up JDK 11 |
| 53 | + uses: actions/setup-java@v1 |
| 54 | + with: |
| 55 | + java-version: 11 |
| 56 | + - name: Cache sbt |
| 57 | + uses: actions/cache@v2 |
| 58 | + with: |
| 59 | + path: | |
| 60 | + ~/.sbt |
| 61 | + ~/.ivy2/cache |
| 62 | + ~/.coursier |
| 63 | + key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }} |
| 64 | + - name: Compile |
| 65 | + run: sbt compile |
| 66 | + - name: Publish artifacts |
| 67 | + run: sbt ci-release |
| 68 | + env: |
| 69 | + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} |
| 70 | + PGP_SECRET: ${{ secrets.PGP_SECRET }} |
| 71 | + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} |
| 72 | + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} |
| 73 | + - name: Extract version from commit message |
| 74 | + run: | |
| 75 | + version=${GITHUB_REF/refs\/tags\/v/} |
| 76 | + echo "VERSION=$version" >> $GITHUB_ENV |
| 77 | + env: |
| 78 | + COMMIT_MSG: ${{ github.event.head_commit.message }} |
| 79 | + - name: Publish release notes |
| 80 | + uses: release-drafter/release-drafter@v5 |
| 81 | + with: |
| 82 | + config-name: release-drafter.yml |
| 83 | + publish: true |
| 84 | + name: "v${{ env.VERSION }}" |
| 85 | + tag: "v${{ env.VERSION }}" |
| 86 | + version: "v${{ env.VERSION }}" |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + - name: Cleanup |
| 90 | + run: | |
| 91 | + rm -rf "$HOME/.ivy2/local" || true |
| 92 | + find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true |
| 93 | + find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true |
| 94 | + find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true |
| 95 | + find $HOME/.sbt -name "*.lock" -delete || true |
0 commit comments