Skip to content

Commit e1dfcce

Browse files
committed
add github actions
1 parent 636650c commit e1dfcce

10 files changed

+357
-0
lines changed

.github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* @qbicsoftware/itss
2+

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/labeler.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
feature:
2+
- any:
3+
- head-branch: [ '^feature' ]
4+
fix:
5+
- any:
6+
- head-branch: [ '^fix', '^hotfix' ]
7+
chore:
8+
- any:
9+
- head-branch: [ '^chore', '^documentation', '^docs', '^ci', '^refactor' ]
10+
release:
11+
- all:
12+
- base-branch: [ 'main', 'master' ]
13+
- head-branch: [ 'development', 'dev' ]

.github/release.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
authors:
6+
- JohnnyQ5
7+
- github-actions
8+
categories:
9+
- title: New Features 🚀
10+
labels:
11+
- feature
12+
- title: Bugfixes 🪲
13+
labels:
14+
- fix
15+
- title: Documentation & CI 🪂
16+
labels:
17+
- chore
18+
- title: Others 🧃
19+
labels:
20+
- "*"

.github/workflows/build_package.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build Maven Package
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: [ main, master ]
10+
11+
jobs:
12+
package:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Set up JDK 8
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: 'zulu'
22+
java-version: '8'
23+
- name: Load local Maven repository cache
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/.m2/repository
27+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28+
restore-keys: |
29+
${{ runner.os }}-maven-
30+
- name: Run mvn package
31+
run: mvn -B package --file pom.xml

.github/workflows/codeql-analysis.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main, master, development, release/*, hotfix/* ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main, master ]
20+
schedule:
21+
- cron: '21 1 * * 4'
22+
23+
jobs:
24+
analyze:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
actions: read
28+
contents: read
29+
security-events: write
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
language: [ 'java' ]
35+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
36+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
- name: Set up JDK 8
42+
uses: actions/setup-java@v4
43+
with:
44+
distribution: 'zulu'
45+
java-version: '8'
46+
settings-path: ${{ github.workspace }}
47+
48+
- name: Load local Maven repository cache
49+
uses: actions/cache@v3
50+
with:
51+
path: ~/.m2/repository
52+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
53+
restore-keys: |
54+
${{ runner.os }}-maven-
55+
56+
# Initializes the CodeQL tools for scanning.
57+
- name: Initialize CodeQL
58+
uses: github/codeql-action/init@v2
59+
with:
60+
languages: ${{ matrix.language }}
61+
# If you wish to specify custom queries, you can do so here or in a config file.
62+
# By default, queries listed here will override any specified in a config file.
63+
# Prefix the list here with "+" to use these queries and those in the config file.
64+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
65+
66+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
67+
# If this step fails, then you should remove it and run the build manually (see below)
68+
- name: Autobuild
69+
uses: github/codeql-action/autobuild@v2
70+
71+
# ℹ️ Command-line programs to run using the OS shell.
72+
# 📚 https://git.io/JvXDl
73+
74+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
75+
# and modify them (or add more) to build your code if your project
76+
# uses a compiled language
77+
78+
#- run: |
79+
# make bootstrap
80+
# make release
81+
82+
- name: Perform CodeQL Analysis
83+
uses: github/codeql-action/analyze@v2

.github/workflows/create-release.yml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Create Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
versionTag:
7+
description: 'Version Tag (semantic version)'
8+
required: true
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
- name: Set up JDK 8
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: 'zulu'
20+
java-version: '8'
21+
settings-path: ${{ github.workspace }}
22+
23+
- name: Load local Maven repository cache
24+
uses: actions/cache@v3
25+
with:
26+
path: ~/.m2/repository
27+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28+
restore-keys: |
29+
${{ runner.os }}-maven-
30+
31+
- name: Set up git
32+
run: |
33+
git config --global user.email "[email protected]"
34+
git config --global user.name "JohnnyQ5"
35+
36+
- name: Set version in Maven project
37+
run: mvn versions:set -DnewVersion=${{ github.event.inputs.versionTag }}
38+
39+
- name: Build with Maven
40+
run: mvn -B package --file pom.xml
41+
42+
- name: Create Release Notes
43+
if: ${{ !startsWith(github.ref, 'refs/tags/')
44+
&& !( contains(github.event.inputs.versionTag, 'alpha')
45+
|| contains(github.event.inputs.versionTag, 'beta')
46+
|| contains(github.event.inputs.versionTag, 'rc')) }}
47+
uses: actions/github-script@v7
48+
with:
49+
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
50+
script: |
51+
await github.request(`POST /repos/${{ github.repository }}/releases`, {
52+
tag_name: "${{ github.event.inputs.versionTag }}",
53+
generate_release_notes: true
54+
});
55+
56+
- name: Create Pre-Release Notes
57+
if: ${{ !startsWith(github.ref, 'refs/tags/')
58+
&& ( contains(github.event.inputs.versionTag, 'alpha')
59+
|| contains(github.event.inputs.versionTag, 'beta')
60+
|| contains(github.event.inputs.versionTag, 'rc')) }}
61+
uses: actions/github-script@v7
62+
with:
63+
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
64+
script: |
65+
await github.request(`POST /repos/${{ github.repository }}/releases`, {
66+
tag_name: "${{ github.event.inputs.versionTag }}",
67+
generate_release_notes: true,
68+
prerelease: true
69+
});
70+
71+
- name: Publish artefact to QBiC Nexus Repository
72+
run: VAADIN_OFFLINE_KEY=${{ secrets.VAADIN_SERVER_23_2 }} mvn --quiet --settings $GITHUB_WORKSPACE/.github.settings.xml -Pproduction -Dvaadin.force.production.build=true deploy
73+
env:
74+
MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }}
75+
MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
76+
77+
- name: Switch to new branch
78+
run: git checkout -b release/set-version-to-${{ github.event.inputs.versionTag }}
79+
80+
- name: Set remote branch
81+
run: git push --set-upstream origin release/set-version-to-${{ github.event.inputs.versionTag }}
82+
83+
- name: Checkin commit
84+
run: git commit . -m 'Set version to ${{ github.event.inputs.versionTag }}'
85+
86+
- name: Push to Github
87+
run: git push
88+
89+
- name: Open PR with version bump
90+
uses: actions/github-script@v7
91+
with:
92+
github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}}
93+
script: |
94+
await github.request(`POST /repos/${{ github.repository }}/pulls`, {
95+
title: 'Update version to ${{ github.event.inputs.versionTag }}',
96+
head: 'release/set-version-to-${{ github.event.inputs.versionTag }}',
97+
base: 'main'
98+
});
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Label Pull Requests
2+
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
types: [ opened, edited ]
10+
11+
jobs:
12+
Assign-Label-To-Pull-Request:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/[email protected]
16+
with:
17+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow will build a package using Maven and then publish it to
2+
# qbic-repo.qbic.uni-tuebingen.de packages when a release is created
3+
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
4+
5+
name: Deploy Snapshot
6+
7+
on:
8+
push:
9+
branches:
10+
- development
11+
12+
jobs:
13+
publish_snapshot:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
- name: Set up JDK 8
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: 'zulu'
24+
java-version: '8'
25+
settings-path: ${{ github.workspace }}
26+
27+
- name: Load local Maven repository cache
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/.m2/repository
31+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
32+
restore-keys: |
33+
${{ runner.os }}-maven-
34+
# Remove existing snapshot tags which are not supposed to be present
35+
- name: Remove snapshot tags
36+
run: mvn versions:set -DremoveSnapshot
37+
# Set the SNAPSHOT for this build and deployment
38+
- name: Set version in Maven project
39+
run: mvn versions:set -DnewVersion='${project.version}-SNAPSHOT'
40+
41+
- name: Build with Maven
42+
run: VAADIN_OFFLINE_KEY=${{ secrets.VAADIN_SERVER_23_2 }} mvn -B package --file pom.xml
43+
44+
- name: Publish artefact to QBiC Nexus Repository
45+
run: mvn --settings $GITHUB_WORKSPACE/.github.settings.xml deploy
46+
env:
47+
MAVEN_REPO_USERNAME: ${{ secrets.NEXUS_USERNAME }}
48+
MAVEN_REPO_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}

.github/workflows/run_tests.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Run Maven Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: [ main, master ]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Set up JDK 8
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: 'zulu'
22+
java-version: '8'
23+
settings-path: ${{ github.workspace }}
24+
25+
- name: Load local Maven repository cache
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/.m2/repository
29+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
30+
restore-keys: |
31+
${{ runner.os }}-maven-
32+
33+
- name: Run tests
34+
run: mvn clean verify

0 commit comments

Comments
 (0)