-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (101 loc) · 4.02 KB
/
main-integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Main Branch CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Fetching All
run: |
git fetch --prune --unshallow
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
- name: Installing GitVersion
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
uses: gittools/actions/gitversion/setup@v0.9.13
with:
versionSpec: '5.3.x'
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.13
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Setup Java 17 env
uses: actions/setup-java@v1
with:
java-version: 17
distribution: zulu
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
- name: Evaluate New Artifact Version
run: |
NEW_VERSION=${{ steps.gitversion.outputs.semVer }}
echo "Artifact Semantic Version: $NEW_VERSION"
mvn versions:set -DnewVersion=${NEW_VERSION}-SNAPSHOT -s settings.xml
- name: Maven Package
run: |
mvn -e package -s settings.xml -f pom.xml
- name: Login to Docker
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build Docker Image
run: |
RELEASE_TAG=${{ steps.gitversion.outputs.semVer }}
docker build --build-arg release_version=$RELEASE_TAG -t ${{ secrets.DOCKERHUB_USERNAME }}/messing-jar-service:latest -t ${{ secrets.DOCKERHUB_USERNAME }}/messing-jar-service:$RELEASE_TAG .
docker build --build-arg release_version=$RELEASE_TAG --platform linux/arm64/v8 -t ${{ secrets.DOCKERHUB_USERNAME }}/messing-jar-service:arm64v8-latest -t ${{ secrets.DOCKERHUB_USERNAME }}/messing-jar-service:arm64v8-$RELEASE_TAG .
- name: Publish Docker image
run: |
RELEASE_TAG=${{ steps.gitversion.outputs.semVer }}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/messing-jar-service:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/messing-jar-service:$RELEASE_TAG
docker push ${{ secrets.DOCKERHUB_USERNAME }}/messing-jar-service:arm64v8-latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/messing-jar-service:arm64v8-$RELEASE_TAG
echo "Pushed Docker Images with New Release"
- name: Upgrading Version
run: |
RELEASE_TAG=${{ steps.gitversion.outputs.semVer }}
echo $RELEASE_TAG > version.ver
ls
git config user.email ${{ secrets.GIT_EMAIL }}
git config user.name ${{ secrets.GIT_USERNAME }}
git add .
git commit -m "Upgraded Version >> $RELEASE_TAG" || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}
merge-develop:
name: Merge to Develop
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetching
run: |
git fetch --all
- name: Merge to Develop
uses: devmasx/merge-branch@1.4.0
with:
type: now
target_branch: develop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}