Merge pull request #1122 from UdashFramework/sbt-1.9.4 #996
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 | |
env: | |
JAVA_OPTS: "-Dfile.encoding=UTF-8 -Xms1024M -Xmx3072M -Xss4M -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler" | |
on: | |
push: | |
branches: '**' | |
tags: [ "v[0-9]+*" ] | |
pull_request: | |
# avoid duplicate checks (push & PR) further in the review process | |
types: [opened] | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-20.04 # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md | |
strategy: | |
fail-fast: false | |
matrix: | |
scala: [ 2.13.11 ] | |
command: [ udash-jvm/test, udash-js/test, guide-selenium/test ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache sbt | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.sbt | |
~/.ivy2/cache | |
~/.coursier/cache | |
~/.cache/coursier | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}-${{ hashFiles('project/Dependencies.scala') }} | |
restore-keys: ${{ runner.os }}-sbt- | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: Cache npm | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-node- | |
- uses: actions/setup-node@v3 | |
- name: Install jsdom | |
run: npm install [email protected] | |
- name: Run tests | |
run: sbt ++${{ matrix.scala }} ${{ matrix.command }} | |
publish: | |
name: Publish to Sonatype | |
# only run on tag push | |
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v')) | |
needs: [ test ] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 11 | |
- name: Get version | |
id: get_tag_name | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
- name: Import GPG key | |
env: | |
#exported via `gpg -a --export-secret-keys <key> | cat -e | sed 's/\$/\\n/g' | xclip -selection clipboard` and added to org secrets | |
SONATYPE_GPG: ${{ secrets.SONATYPE_GPG }} | |
run: echo -e $SONATYPE_GPG | gpg --import - | |
- name: Publish artifacts | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: sbt 'set ThisBuild/version := "${{ steps.get_tag_name.outputs.VERSION }}"' +publishSigned | |
- name: Release Sonatype bundle | |
#https://github.com/xerial/sbt-sonatype#publishing-your-artifact | |
if: ${{ !endsWith(steps.get_tag_name.outputs.VERSION, 'SNAPSHOT') }} | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: sbt 'set ThisBuild/version := "${{ steps.get_tag_name.outputs.VERSION }}"' sonatypeBundleRelease |