-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83cc7d6
commit f38338b
Showing
14 changed files
with
272 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,60 @@ | ||
name: CI Main Branch | ||
name: ci-main | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- uses: s4u/[email protected] | ||
with: | ||
githubServer: false | ||
servers: | | ||
[ | ||
{ | ||
"id": "dgc-github", | ||
"username": "${{ secrets.GPR_USER }}", | ||
"password": "${{ secrets.GPR_PAT }}" | ||
}, | ||
{ | ||
"id": "ehd-github", | ||
"username": "${{ secrets.GPR_USER }}", | ||
"password": "${{ secrets.GPR_PAT }}" | ||
} | ||
] | ||
- name: Build | ||
run: mvn install | ||
- name: Build for Docker Image | ||
run: mvn clean install -P docker | ||
- name: Log into registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | ||
- name: Build Docker Image | ||
run: docker build target/docker --file target/docker/Dockerfile --tag docker.pkg.github.com/${{ github.repository }}/backend:latest | ||
- name: Push Docker Image | ||
run: docker push docker.pkg.github.com/${{ github.repository }}/backend:latest | ||
- uses: actions/setup-java@v2 | ||
with: | ||
java-version: 11 | ||
distribution: adopt | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | ||
- name: version | ||
run: >- | ||
APP_SHA=$(git rev-parse --short ${GITHUB_SHA}); | ||
APP_REV=$(git rev-list --tags --max-count=1); | ||
APP_TAG=$(git describe --tags ${APP_REV} 2> /dev/null || echo 0.0.0); | ||
APP_VERSION=${APP_TAG}-${APP_SHA}; | ||
echo "APP_SHA=${APP_SHA}" >> ${GITHUB_ENV}; | ||
echo "APP_TAG=${APP_TAG}" >> ${GITHUB_ENV}; | ||
echo "APP_VERSION=${APP_VERSION}" >> ${GITHUB_ENV}; | ||
- name: mvn | ||
run: >- | ||
mvn versions:set | ||
--batch-mode | ||
--file ./pom.xml | ||
--settings ./settings.xml | ||
--define newVersion="${APP_VERSION}"; | ||
mvn clean verify | ||
--batch-mode | ||
--file ./pom.xml | ||
--settings ./settings.xml | ||
--define app.packages.username="${APP_PACKAGES_USERNAME}" | ||
--define app.packages.password="${APP_PACKAGES_PASSWORD}"; | ||
env: | ||
APP_PACKAGES_USERNAME: ${{ github.actor }} | ||
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
- name: docker | ||
run: >- | ||
echo "${APP_PACKAGES_PASSWORD}" | | ||
docker login "${APP_PACKAGES_URL}" | ||
--username "${APP_PACKAGES_USERNAME}" | ||
--password-stdin; | ||
docker build . | ||
--file ./Dockerfile | ||
--tag "${APP_PACKAGES_URL}:${APP_VERSION}"; | ||
docker push "${APP_PACKAGES_URL}:${APP_VERSION}"; | ||
env: | ||
APP_PACKAGES_URL: docker.pkg.github.com/${{ github.repository }}/container | ||
APP_PACKAGES_USERNAME: ${{ github.actor }} | ||
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: ci-release | ||
on: | ||
release: | ||
types: | ||
- created | ||
jobs: | ||
release: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/setup-java@v2 | ||
with: | ||
java-version: 11 | ||
distribution: adopt | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | ||
- name: version | ||
run: >- | ||
APP_SHA=$(git rev-parse --short ${GITHUB_SHA}); | ||
APP_TAG=${GITHUB_REF/refs\/tags\/} | ||
APP_VERSION=${APP_TAG}; | ||
echo "APP_SHA=${APP_SHA}" >> ${GITHUB_ENV}; | ||
echo "APP_TAG=${APP_TAG}" >> ${GITHUB_ENV}; | ||
echo "APP_VERSION=${APP_VERSION}" >> ${GITHUB_ENV}; | ||
- name: mvn | ||
run: >- | ||
mvn versions:set | ||
--batch-mode | ||
--file ./pom.xml | ||
--settings ./settings.xml | ||
--define newVersion="${APP_VERSION}"; | ||
mvn clean deploy | ||
--batch-mode | ||
--file ./pom.xml | ||
--settings ./settings.xml | ||
--define app.packages.username="${APP_PACKAGES_USERNAME}" | ||
--define app.packages.password="${APP_PACKAGES_PASSWORD}"; | ||
env: | ||
APP_PACKAGES_USERNAME: ${{ github.actor }} | ||
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
- name: docker | ||
run: >- | ||
echo "${APP_PACKAGES_PASSWORD}" | | ||
docker login "${APP_PACKAGES_URL}" | ||
--username "${APP_PACKAGES_USERNAME}" | ||
--password-stdin; | ||
docker build . | ||
--file ./Dockerfile | ||
--tag "${APP_PACKAGES_URL}:latest" | ||
--tag "${APP_PACKAGES_URL}:${APP_VERSION}"; | ||
docker push "${APP_PACKAGES_URL}:latest"; | ||
docker push "${APP_PACKAGES_URL}:${APP_VERSION}"; | ||
env: | ||
APP_PACKAGES_URL: docker.pkg.github.com/${{ github.repository }}/container | ||
APP_PACKAGES_USERNAME: ${{ github.actor }} | ||
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: ci-sonar | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
jobs: | ||
sonar: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/setup-java@v2 | ||
with: | ||
java-version: 11 | ||
distribution: adopt | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }} | ||
- name: mvn | ||
run: >- | ||
mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | ||
--batch-mode | ||
--file ./pom.xml | ||
--settings ./settings.xml | ||
--define app.packages.username="${APP_PACKAGES_USERNAME}" | ||
--define app.packages.password="${APP_PACKAGES_PASSWORD}"; | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
APP_PACKAGES_USERNAME: ${{ github.actor }} | ||
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM adoptopenjdk:11-jre-hotspot | ||
COPY ./target/*.jar /app/app.jar | ||
WORKDIR /app | ||
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar ./app.jar" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.