Skip to content

Commit 7a9da0d

Browse files
authored
ST6RI-849 Initialize Github Actions based build
This change initializes a build based on Github Actions with the following concepts: - Only the master branch and pull requests are built - All previous build functionality, including the generated library index generation is added - Github packages are not updated from a pull request build
1 parent 14f1d77 commit 7a9da0d

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Java CI with Maven
10+
11+
on:
12+
push:
13+
branches: [ "master" ]
14+
pull_request:
15+
branches: '**'
16+
17+
jobs:
18+
build:
19+
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up JDK 17
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: '17'
28+
distribution: 'temurin'
29+
cache: maven
30+
- name: Build with Maven
31+
run: ./mvnw -B clean verify --file pom.xml
32+
- name: Publish Test Report
33+
uses: mikepenz/action-junit-report@v5
34+
if: success() || failure() # always run even if the previous step fails
35+
with:
36+
report_paths: '**/target/surefire-reports/TEST-*.xml'
37+
include_passed: true
38+
- name: Verify index generation
39+
run: echo $(git diff -- sysml.library/.index.json) | grep -e '^$' || (echo "Library index in the git repository is not up to date. Please re-generate it and push changes to the repository."; exit 1)
40+
- name: Publish to Github Packages
41+
if: github.event_name != 'pull_request'
42+
run: ./mvnw -B deploy -DskipTests=true
43+
env:
44+
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password

0 commit comments

Comments
 (0)