Skip to content

Commit 3e6bfa1

Browse files
authored
Create build.yaml
1 parent c5d9853 commit 3e6bfa1

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/build.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Deploy
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- 'v[0-9]+.*'
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
builds:
14+
if: ${{ !(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }}
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK 11
20+
uses: actions/setup-java@v1
21+
with:
22+
java-version: 11
23+
24+
- name: Cache Maven packages
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.m2
28+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
29+
restore-keys: ${{ runner.os }}-m2
30+
31+
- name: Test with Maven
32+
run: mvn -B --update-snapshots compile test
33+
34+
- name: Attach artifact
35+
id: build-artifact
36+
uses: SWAT-engineering/maven-full-artifacts-action@v1
37+
38+
- name: Prepare Draft Release
39+
uses: softprops/action-gh-release@v1
40+
if: startsWith(github.ref, 'refs/tags/')
41+
with:
42+
draft: true
43+
files: ${{ steps.build-artifact.outputs.artifact-root-dir}}/**/*
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Deploy
48+
if: startsWith(github.ref, 'refs/tags/v')
49+
uses: usethesource/releases-maven-action@v1
50+
with:
51+
maven-username: ${{ secrets.RELEASE_MAVEN_USERNAME }}
52+
maven-password: ${{ secrets.RELEASE_MAVEN_PASSWORD }}
53+
maven-local-port: ${{ secrets.RELEASE_MAVEN_LOCAL_PORT }}
54+
ssh-hostname: ${{ secrets.RELEASE_SSH_SERVER }}
55+
ssh-known-host: ${{ secrets.RELEASE_SSH_KNOWN_HOSTS }}
56+
ssh-username: ${{ secrets.RELEASE_SSH_USERNAME }}
57+
ssh-private-key: ${{ secrets.RELEASE_SSH_PRIVATE_KEY }}

0 commit comments

Comments
 (0)