-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
1 changed file
with
89 additions
and
88 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 |
---|---|---|
|
@@ -3,94 +3,94 @@ name: Build backend release | |
on: [workflow_dispatch] | ||
|
||
jobs: | ||
release: | ||
name: Create docker release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout to main branch # Releases are published on main branch | ||
uses: actions/checkout@v4 | ||
with: { ref: main } | ||
|
||
- name: Install Java and Maven | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "17" | ||
distribution: "temurin" | ||
cache: "maven" | ||
|
||
- name: Clean Maven Project Version | ||
id: set-version | ||
run: | | ||
current_version=$(mvn help:evaluate -f mobidam-sst-management-backend/pom.xml -Dexpression=project.version -q -DforceStdout) | ||
echo "Current version: $current_version" | ||
new_version=$(echo $current_version | sed 's/-SNAPSHOT//') | ||
echo "New version: $new_version" | ||
mvn -B versions:set -f mobidam-sst-management-backend/pom.xml -DnewVersion=$new_version | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git add mobidam-sst-management-backend/pom.xml | ||
git commit -m "Bump backend main version to $new_version" | ||
git push | ||
echo "new_version=$new_version" >> $GITHUB_OUTPUT | ||
- name: Build with Maven | ||
run: mvn -B verify -f mobidam-sst-management-backend/pom.xml -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract Docker metadata | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ github.repository }}-backend | ||
|
||
- name: Build and push app | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./mobidam-sst-management-backend | ||
push: true | ||
tags: ghcr.io/it-at-m/mobidam-sst-management-backend:${{ steps.set-version.outputs.new_version }} | ||
|
||
github-release: | ||
needs: release | ||
name: Create github release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout to main branch # Releases are published on main branch | ||
uses: actions/checkout@v4 | ||
with: { ref: main } | ||
|
||
- name: Get New Project Version | ||
id: get-version | ||
run: | | ||
current_version=$(mvn help:evaluate -f mobidam-sst-management-backend/pom.xml -Dexpression=project.version -q -DforceStdout) | ||
new_version=$(echo $current_version | sed 's/-SNAPSHOT//') | ||
echo "New version: $new_version" | ||
echo "new_version=$new_version" >> $GITHUB_OUTPUT | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: backend-${{ steps.get-version.outputs.new_version }} | ||
release_name: Release Backend ${{ steps.get-version.outputs.new_version }} | ||
draft: false | ||
prerelease: false | ||
# release: | ||
# name: Create docker release | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Git checkout to main branch # Releases are published on main branch | ||
# uses: actions/checkout@v4 | ||
# with: { ref: main } | ||
# | ||
# - name: Install Java and Maven | ||
# uses: actions/setup-java@v3 | ||
# with: | ||
# java-version: "17" | ||
# distribution: "temurin" | ||
# cache: "maven" | ||
# | ||
# - name: Clean Maven Project Version | ||
# id: set-version | ||
# run: | | ||
# current_version=$(mvn help:evaluate -f mobidam-sst-management-backend/pom.xml -Dexpression=project.version -q -DforceStdout) | ||
# echo "Current version: $current_version" | ||
# new_version=$(echo $current_version | sed 's/-SNAPSHOT//') | ||
# echo "New version: $new_version" | ||
# mvn -B versions:set -f mobidam-sst-management-backend/pom.xml -DnewVersion=$new_version | ||
# git config --global user.email "[email protected]" | ||
# git config --global user.name "GitHub Actions" | ||
# git add mobidam-sst-management-backend/pom.xml | ||
# git commit -m "Bump backend main version to $new_version" | ||
# git push | ||
# echo "new_version=$new_version" >> $GITHUB_OUTPUT | ||
# | ||
# - name: Build with Maven | ||
# run: mvn -B verify -f mobidam-sst-management-backend/pom.xml -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN | ||
# | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v2 | ||
# | ||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v2 | ||
# | ||
# - name: Login to Registry | ||
# uses: docker/login-action@v3 | ||
# with: | ||
# registry: ghcr.io | ||
# username: ${{ github.actor }} | ||
# password: ${{ secrets.GITHUB_TOKEN }} | ||
# | ||
# - name: Extract Docker metadata | ||
# uses: docker/metadata-action@v5 | ||
# with: | ||
# images: ${{ env.REGISTRY }}/${{ github.repository }}-backend | ||
# | ||
# - name: Build and push app | ||
# uses: docker/build-push-action@v4 | ||
# with: | ||
# context: ./mobidam-sst-management-backend | ||
# push: true | ||
# tags: ghcr.io/it-at-m/mobidam-sst-management-backend:${{ steps.set-version.outputs.new_version }} | ||
# | ||
# github-release: | ||
# needs: release | ||
# name: Create github release | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Git checkout to main branch # Releases are published on main branch | ||
# uses: actions/checkout@v4 | ||
# with: { ref: main } | ||
# | ||
# - name: Get New Project Version | ||
# id: get-version | ||
# run: | | ||
# current_version=$(mvn help:evaluate -f mobidam-sst-management-backend/pom.xml -Dexpression=project.version -q -DforceStdout) | ||
# new_version=$(echo $current_version | sed 's/-SNAPSHOT//') | ||
# echo "New version: $new_version" | ||
# echo "new_version=$new_version" >> $GITHUB_OUTPUT | ||
# | ||
# - name: Create GitHub Release | ||
# id: create_release | ||
# uses: actions/create-release@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# tag_name: backend-${{ steps.get-version.outputs.new_version }} | ||
# release_name: Release Backend ${{ steps.get-version.outputs.new_version }} | ||
# draft: false | ||
# prerelease: false | ||
|
||
increase-snapshot: | ||
needs: release | ||
# needs: release | ||
name: Increase patch-number of the SNAPSHOT-Version | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -110,7 +110,8 @@ jobs: | |
mvn -B versions:set -DnewVersion=$new_version -f mobidam-sst-management-backend/pom.xml | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git branch release-$new_version | ||
git checkout -b release-$new_version | ||
git add mobidam-sst-management-backend/pom.xml | ||
git commit -m "Bump backend sprint version to $new_version" | ||
gh pr create --title "Bump backend version to $new_version" --base sprint --head release-$new_version --reviewer it-at-m/mobidam_admin --body "Bump backend version to $new_version after Release build" | ||
git push --set-upstream origin release-$new_version | ||
gh pr create --title "Bump backend version to $new_version" --base sprint --head release-$new_version --reviewer @it-at-m/mobidam_admin --body "Bump backend version to $new_version after Release build" |