-
Notifications
You must be signed in to change notification settings - Fork 3
124 lines (117 loc) · 3.85 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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 }}