-
Notifications
You must be signed in to change notification settings - Fork 15
79 lines (77 loc) · 2.14 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
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
name: CI
on:
pull_request:
push:
branches:
- master
tags:
- "*.*"
env:
MYSQL_USER: root
MYSQL_PASSWORD: root
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: corretto
- uses: actions/cache@v3
with:
path: |
~/.ivy2
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}
- name: Start mysql
run: sudo /etc/init.d/mysql start
- name: Set SBT_OPTS
run: bash generate_sbt_opts.sh
- name: Build
run: sbt package
- name: Test
run: sbt test scalafmtCheckAll
- uses: actions/upload-artifact@v3
with:
name: jars
path: '*/target/**/*.jar'
retention-days: 1
publish:
if: ${{ github.event_name != 'pull_request' }} && (github.repository == 'lucidsoftware/java-thread-context') }}
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.ivy2
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}
- name: Set SBT_OPTS
run: bash generate_sbt_opts.sh
- name: Publish to Sonatype
run: bash publish.sh
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
release:
if: ${{ startsWith(github.ref, 'refs/tags') && (github.repository == 'lucidsoftware/relate') }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: jars
- name: Upload Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
tag="${GITHUB_REF#refs/tags/}"
targets=($(printf -- "-a %s " */target/**/*.jar))
hub release create "${targets[@]}" -m "Release $tag" $tag