Skip to content

Add Cross Compile Support #33

Add Cross Compile Support

Add Cross Compile Support #33

Workflow file for this run

name: Scala CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
MAJOR_MINOR_VERSION: 0.1.
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
scala: [2.12.19, 2.13.12]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}-${{ matrix.scala }}
- name: Run tests
working-directory: scalatest-listener
run: sbt ++${{ matrix.scala }} test
- name: Build project
working-directory: scalatest-listener
run: sbt ++${{ matrix.scala }} compile
- name: Prepare and Sign Artifact
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_SECRET_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
BUNDLE_VERSION_NUMBER: ${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
BUNDLE_PATH: ./target/sonatype-staging/0.1.0-SNAPSHOT
working-directory: scalatest-listener
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import --batch
echo "$GPG_PUBLIC_KEY" | gpg --import --batch
mkdir -p $HOME/.sbt/gpg
gpg --batch --pinentry-mode=loopback --yes --passphrase $GPG_PASSPHRASE --output $HOME/.sbt/gpg/secring.asc --export-secret-key --armor
sbt ++${{ matrix.scala }} publishSigned
cd $BUNDLE_PATH && zip -r ${GITHUB_WORKSPACE}/bundle_${{ matrix.scala }}.zip .
- name: Publish to Maven Central
env:
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
PUBLISH_TYPE_PARAMS: AUTOMATIC
BUNDLE_NAME: io.agodadev.testmetricsscala_${{ matrix.scala }}
working-directory: scalatest-listener
run: |
AUTH_TOKEN=$(echo -n "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64)
curl --location "https://central.sonatype.com/api/v1/publisher/upload?publishingType=${PUBLISH_TYPE_PARAMS}" \
--header "Authorization: Bearer ${AUTH_TOKEN}" \
--form "bundle=@${GITHUB_WORKSPACE}/bundle_${{ matrix.scala }}.zip" \
--form "name=${BUNDLE_NAME}"