-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 2.89 KB
/
main.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
name: main
on:
push:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
MONGODB_REPO: tech1-io/tech1-framework-b2b-mongodb-server
POSTGRES_REPO: tech1-io/tech1-framework-b2b-postgres-server
VERSION: '2.8.4-SNAPSHOT'
DOCKER_REQUIRED: 'true'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
main:
runs-on: ubuntu-latest
outputs:
job_status: ${{ steps.tech1_mails_v2.outputs.job_status }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Java17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: GitHub Packages
run: |
mvn clean install \
-Ddeployment_github_username=${{ github.actor }} -Ddeployment_github_token=${{ secrets.GITHUB_TOKEN }} \
-s release-github/m2-settings.xml deploy -Prelease-github
- name: Docker login
if: env.DOCKER_REQUIRED == 'true'
run: docker login ${{ env.REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
- name: Docker [mongodb]
if: env.DOCKER_REQUIRED == 'true'
run: |
cd tech1-framework-b2b-mongodb-server
docker build -t ${{ env.REGISTRY }}/${{ env.MONGODB_REPO }}:${{ env.VERSION }} .
docker push ${{ env.REGISTRY }}/${{ env.MONGODB_REPO }}:${{ env.VERSION }}
- name: Docker [postgres]
if: env.DOCKER_REQUIRED == 'true'
run: |
cd tech1-framework-b2b-postgres-server
docker build -t ${{ env.REGISTRY }}/${{ env.POSTGRES_REPO }}:${{ env.VERSION }} .
docker push ${{ env.REGISTRY }}/${{ env.POSTGRES_REPO }}:${{ env.VERSION }}
- name: Tech1 mails@v2 outputs
if: always()
id: tech1_mails_v2
run: echo "job_status=${{ job.status }}" >> $GITHUB_OUTPUT
mails:
if: always()
needs: [main]
runs-on: ubuntu-latest
steps:
- name: Mails
if: always()
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.SMTP_GMAIL_USERNAME }}
password: ${{ secrets.SMTP_GMAIL_PASSWORD }}
subject: '${{ needs.main.outputs.job_status }}: ${{ github.repository }} » ${{ github.ref_name }}, ${{ github.workflow }} # ${{ github.run_number }}'
to: ${{ secrets.EMAILS_ADMINS }}
from: Tech1 Ops
html_body: |
<b>CommitterId</b>: ${{ github.actor }}<br>
<b>Actions</b>: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}<br>
<b>Changes</b>: https://github.com/${{ github.repository }}/commit/${{ github.sha }}<br>
<b>Committer</b>: ${{ github.event.commits[0].committer.name }}<br>
<b>Message</b>: ${{ github.event.commits[0].message }}<br>