Merge pull request #92 from lucidsoftware/cwoodfield-update-publish-r… #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- "*.*" | |
env: | |
MYSQL_USER: root | |
MYSQL_PASSWORD: root | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: corretto | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.ivy2 | |
~/.sbt | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }} | |
- name: Start mysql | |
run: sudo /etc/init.d/mysql start | |
- name: Set SBT_OPTS | |
run: bash generate_sbt_opts.sh | |
- name: Build | |
run: sbt package | |
- name: Test | |
run: sbt test scalafmtCheckAll | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: jars | |
path: '*/target/**/*.jar' | |
retention-days: 1 | |
publish: | |
if: github.event_name != 'pull_request' && (github.repository == 'lucidsoftware/relate') | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.ivy2 | |
~/.sbt | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }} | |
- name: Set SBT_OPTS | |
run: bash generate_sbt_opts.sh | |
- name: Publish to Sonatype | |
run: bash publish.sh | |
env: | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
release: | |
if: startsWith(github.ref, 'refs/tags') && (github.repository == 'lucidsoftware/relate') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: jars | |
- name: Upload Assets | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -x | |
tag="${GITHUB_REF#refs/tags/}" | |
gh release create "$tag" -n "Release $tag" */target/**/*.jar |