Skip to content

Commit b4c6160

Browse files
authored
Merge pull request #7 from CleverCloud/maven-release
Refactor release the setup for publishing to Maven Central.
2 parents 13e8874 + c9b6f8c commit b4c6160

File tree

1 file changed

+149
-20
lines changed

1 file changed

+149
-20
lines changed
Lines changed: 149 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,158 @@
1-
name: Publish package to the Maven Central Repository
1+
name: release
2+
23
on:
3-
release:
4-
types: [created]
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "The release version"
8+
required: true
9+
branch:
10+
description: "The branch to release from"
11+
required: true
12+
default: "master"
13+
514
jobs:
6-
publish:
15+
release-scala-2-12:
716
runs-on: ubuntu-latest
817
steps:
9-
- name: Install gpg secret key
18+
- name: checkout the repo
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- uses: awalsh128/cache-apt-pkgs-action@latest
24+
with:
25+
packages: docker-compose
26+
version: 1.0
27+
28+
- name: Set up JDK
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: temurin
32+
java-version: 17
33+
34+
- name: Setup sbt launcher
35+
uses: sbt/setup-sbt@v1
36+
37+
- name: Launch pulsar docker
38+
run: docker-compose up -d
39+
40+
- name: Import GPG key
41+
id: import_gpg
42+
uses: crazy-max/ghaction-import-gpg@v6
43+
with:
44+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
45+
passphrase: ${{ secrets.PGP_PASSPHRASE }}
46+
47+
- name: GPG user IDs
48+
run: |
49+
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
50+
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
51+
echo "name: ${{ steps.import_gpg.outputs.name }}"
52+
echo "email: ${{ steps.import_gpg.outputs.email }}"
53+
54+
- name: run tests
55+
run: sbt ++2.12 test
56+
57+
- name: publish release
58+
run: sbt ++2.12 publishSigned
59+
env:
60+
RELEASE_VERSION: ${{ github.event.inputs.version }}
61+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
62+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
63+
64+
release-scala-2-13:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: checkout the repo
68+
uses: actions/checkout@v2
69+
with:
70+
fetch-depth: 0
71+
72+
- uses: awalsh128/cache-apt-pkgs-action@latest
73+
with:
74+
packages: docker-compose
75+
version: 1.0
76+
77+
- name: Set up JDK
78+
uses: actions/setup-java@v4
79+
with:
80+
distribution: temurin
81+
java-version: 17
82+
83+
- name: Setup sbt launcher
84+
uses: sbt/setup-sbt@v1
85+
86+
- name: Launch pulsar docker
87+
run: docker-compose up -d
88+
89+
- name: Import GPG key
90+
id: import_gpg
91+
uses: crazy-max/ghaction-import-gpg@v6
92+
with:
93+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
94+
passphrase: ${{ secrets.PGP_PASSPHRASE }}
95+
96+
- name: GPG user IDs
1097
run: |
11-
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
12-
- name: Checkout
98+
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
99+
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
100+
echo "name: ${{ steps.import_gpg.outputs.name }}"
101+
echo "email: ${{ steps.import_gpg.outputs.email }}"
102+
103+
- name: run tests
104+
run: sbt ++2.13 test
105+
106+
- name: publish release
107+
run: sbt ++2.13 publishSigned
108+
env:
109+
RELEASE_VERSION: ${{ github.event.inputs.version }}
110+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
111+
112+
release-scala-3:
113+
runs-on: ubuntu-latest
114+
steps:
115+
- name: checkout the repo
13116
uses: actions/checkout@v2
14-
- name: Set up Maven Central Repository
15-
uses: actions/setup-java@v2
16-
with:
17-
java-version: "11"
18-
distribution: "adopt"
19-
server-id: ossrh
20-
server-username: MAVEN_USERNAME
21-
server-password: MAVEN_PASSWORD
117+
with:
118+
fetch-depth: 0
119+
120+
- uses: awalsh128/cache-apt-pkgs-action@latest
121+
with:
122+
packages: docker-compose
123+
version: 1.0
124+
125+
- name: Set up JDK
126+
uses: actions/setup-java@v4
127+
with:
128+
distribution: temurin
129+
java-version: 17
130+
22131
- name: Setup sbt launcher
23132
uses: sbt/setup-sbt@v1
24-
- name: Publish package
25-
run: sbt publishSigned
133+
134+
- name: Launch pulsar docker
135+
run: docker-compose up -d
136+
137+
- name: Import GPG key
138+
id: import_gpg
139+
uses: crazy-max/ghaction-import-gpg@v6
140+
with:
141+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
142+
passphrase: ${{ secrets.PGP_PASSPHRASE }}
143+
144+
- name: GPG user IDs
145+
run: |
146+
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
147+
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
148+
echo "name: ${{ steps.import_gpg.outputs.name }}"
149+
echo "email: ${{ steps.import_gpg.outputs.email }}"
150+
151+
- name: run tests
152+
run: sbt ++3.3 test
153+
154+
- name: publish release
155+
run: sbt ++3.3 publishSigned
26156
env:
27-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
28-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
29-
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
157+
RELEASE_VERSION: ${{ github.event.inputs.version }}
158+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}

0 commit comments

Comments
 (0)