-
Notifications
You must be signed in to change notification settings - Fork 13
53 lines (46 loc) · 1.62 KB
/
ci.yaml
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
name: CI
# We run CI on PRs targetting main, and pushes to the main branch. We also run
# on release created events, using the tag name as the version.
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- created
jobs:
ci:
name: Package, Test, and Release
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
cache: maven
- name: Set POM version
# Set the version in the POM to the short commit hash and append
# -SNAPSHOT to the version. This allows us to test the release process
# on branches without having to push a tag. If we are triggered by a
# release event, we set the version to the release version as the tag.
run: |
if [[ $GITHUB_EVENT_NAME == release ]]; then
mvn versions:set -DnewVersion=${GITHUB_REF#refs/tags/} --file posthog/pom.xml
else
mvn versions:set -DnewVersion=$(git rev-parse --short HEAD)-SNAPSHOT --file posthog/pom.xml
fi
- name: Build with Maven
run: mvn package --file posthog/pom.xml -DskipTests --batch-mode --show-version
- name: Run tests
run: mvn test --file posthog/pom.xml --batch-mode --show-version