Skip to content

Commit ea1ec66

Browse files
Java deploy (#10)
* Java deploy * Formatted the pom.xml * rename * on pull request (#11) * Update to deploy on releases on main Co-authored-by: Mike Hamer <[email protected]>
1 parent 877d147 commit ea1ec66

File tree

11 files changed

+307
-1
lines changed

11 files changed

+307
-1
lines changed

.github/actions/deploy/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Container image that runs your code
2+
FROM maven:3.6.2-jdk-14
3+
4+
# Copies your code file from your action repository to the filesystem path `/` of the container
5+
COPY entrypoint.sh /entrypoint.sh
6+
7+
#Make entrypoint.sh exacutable
8+
RUN chmod +x /entrypoint.sh
9+
10+
# Code file to execute when the docker container starts up (`entrypoint.sh`)
11+
ENTRYPOINT ["/entrypoint.sh"]

.github/actions/deploy/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# action.yml
2+
name: 'Java Deploy'
3+
description: 'Deploys Java sdk to Maven'
4+
runs:
5+
using: 'docker'
6+
image: 'Dockerfile'
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
gpg --quiet --batch --yes --passphrase=$GPG_KEY_PASSPHRASE --output ./.github/secrets/private.key --decrypt ./.github/secrets/private.key.enc
4+
5+
gpg --import ./.github/secrets/private.key
6+
gpg --import ./.github/secrets/public.key
7+
8+
ls -la
9+
10+
cat << EOF > tempsettings.xml
11+
<settings>
12+
<servers>
13+
<server>
14+
<id>ossrh</id>
15+
<username>$MVN_USERNAME</username>
16+
<password>$MVN_PASSWORD</password>
17+
</server>
18+
</servers>
19+
</settings>
20+
EOF
21+
22+
mvn --settings ./tempsettings.xml deploy
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Container image that runs your code
2+
FROM maven:3.6.2-jdk-14
3+
4+
# Copies your code file from your action repository to the filesystem path `/` of the container
5+
COPY entrypoint.sh /entrypoint.sh
6+
7+
#Make entrypoint.sh exacutable
8+
RUN chmod +x /entrypoint.sh
9+
10+
# Code file to execute when the docker container starts up (`entrypoint.sh`)
11+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# action.yml
2+
name: 'Java Install'
3+
description: 'Runs Maven install command which will also run the tests'
4+
runs:
5+
using: 'docker'
6+
image: 'Dockerfile'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
mvn install

.github/secrets/private.key.enc

2.55 KB
Binary file not shown.

.github/secrets/public.key

1.21 KB
Binary file not shown.

.github/workflows/deploy.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Deploy to Maven
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
jobs:
8+
deploy:
9+
name: Push the Java SDK Maven
10+
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v1
15+
- name: Java Maven Upload
16+
uses: ./.github/actions/deploy-maven
17+
env:
18+
MVN_USERNAME: ${{ secrets.MVN_USERNAME }}
19+
MVN_PASSWORD: ${{ secrets.MVN_PASSWORD }}
20+
GPG_KEY_PASSPHRASE: ${{ secrets.GPG_KEY_PASSPHRASE }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Deploy to Maven
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy-java:
10+
name: Push the Java SDK Maven
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v1
15+
- name: Java Maven Install
16+
uses: ./.github/actions/maven-install

0 commit comments

Comments
 (0)