-
Notifications
You must be signed in to change notification settings - Fork 3
69 lines (62 loc) · 2.78 KB
/
sbt-build.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
name: Build & Publish
on:
#workflow_dispatch:
push:
branches:
- feature/artifact-publish
- master
workflow_dispatch:
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK And SBT
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: "sbt"
- name: Decrypt and Import GPG Key
run: |
gpgconf --kill gpg-agent || true
gpgconf --launch gpg-agent || true
echo "$PGP_SECRET" | base64 --decode | gpg --batch --no-tty --import
env:
PGP_SECRET: ${{ secrets.GPG_SECRET }}
- name: Verify Resources
run: |
echo "---------- Verifying GPG Keys ----------"
GPG_FINGERPRINT=$(gpg --list-keys --with-colons | grep fpr | head -n 1 | cut -d: -f10)
echo "GPG_FINGERPRINT=$GPG_FINGERPRINT" >> $GITHUB_ENV
gpg --keyserver keyserver.ubuntu.com --recv-keys $GPG_FINGERPRINT
echo "----------------------------------------"
echo "----------------------------------------"
echo "---------- Verifying Existence of Sonatype Credentials ----------"
if [ -z "$SONATYPE_USERNAME" ]; then echo "SONATYPE_USERNAME is not set"; else echo "SONATYPE_USERNAME is set"; fi
if [ -z "$SONATYPE_PASSWORD" ]; then echo "SONATYPE_PASSWORD is not set"; else echo "SONATYPE_PASSWORD is set"; fi
echo "-----------------------------------------------------------------"
echo "-----------------------------------------------------------------"
echo "---------- Verifying Existence of PGP Variables ----------"
if [ -z "$PGP_PASSPHRASE" ]; then echo "PGP_PASSPHRASE is not set"; else echo "PGP_PASSPHRASE is set"; fi
if [ -z "$PGP_SECRET" ]; then echo "PGP_SECRET is not set"; else echo "PGP_SECRET is set"; fi
echo "----------------------------------------------------------"
echo "----------------------------------------------------------"
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
PGP_SECRET: ${{ secrets.GPG_SECRET }}
- name: Publish to Maven Repository
run: sbt -debug ci-release
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
PGP_SECRET: ${{ secrets.GPG_SECRET }}
# - name: Publish to GitHub Packages
# run: sbt publish
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}