Add sts dependency #212
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: | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
- develop | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ '8', '11'] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: coursier/cache-action@v5 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Run tests | |
run: sbt clean scalafmtCheckAll test | |
docker-release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: coursier/cache-action@v6 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: adopt | |
- name: Get current version | |
id: ver | |
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
- name: Docker login | |
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Stage the Docker build | |
run: sbt "project sinks" docker:stage | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: snowplow/snowplow-event-generator-sinks | |
tags: | | |
type=raw,value=latest,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }} | |
type=raw,value=${{ steps.ver.outputs.tag }} | |
flavor: | | |
latest=false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Push image | |
uses: docker/build-push-action@v2 | |
with: | |
context: sinks/target/docker/stage | |
file: sinks/target/docker/stage/Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true | |
deploy_common: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: adopt | |
- name: Deploy common on Bintray Maven and Maven Central | |
run: sbt "project core" ci-release | |
env: | |
PGP_PASSPHRASE: ${{ secrets.SONA_PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.SONA_PGP_SECRET }} | |
SONATYPE_USERNAME: ${{ secrets.SONA_USER }} | |
SONATYPE_PASSWORD: ${{ secrets.SONA_PASS }} | |
github_release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: coursier/cache-action@v6 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: adopt | |
- name: Get current version | |
id: ver | |
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
- name: Assemble fat jars | |
run: sbt assembly | |
- name: Zip artifact | |
run: tar -czf sinks/target/scala-2.13/snowplow-event-generator-${{ steps.ver.outputs.tag }}.tar.gz -C sinks/target/scala-2.13/ snowplow-event-generator | |
- name: Create GitHub release and attach artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
prerelease: ${{ contains(steps.ver.outputs.tag, 'rc') }} | |
name: ${{ steps.ver.outputs.tag }} | |
tag_name: ${{ steps.ver.outputs.tag }} | |
files: | | |
core/target/scala-2.13/snowplow-event-generator-core-${{ steps.ver.outputs.tag }}.jar | |
sinks/target/scala-2.13/snowplow-event-generator-${{ steps.ver.outputs.tag }}.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |