-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (85 loc) · 2.97 KB
/
build.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
name: Open Commercial CI
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build-analyze-deploy:
name: Build, analyze, dockerize, and publish
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v2.4.0
with:
java-version: 17
distribution: temurin
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
AFIP_WS_AUTH_URI: ""
AFIP_WS_FE_URI=: ""
GMAIL_USERNAME: ""
GMAIL_PASSWORD: ""
RECAPTCHA_SECRET_KEY: ""
RECAPTCHA_TEST_KEY: "111111"
CLOUDINARY_URL: ""
MERCADOPAGO_ACCESS_TOKEN: ""
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=open-commercial -Dsonar.projectKey=api:api
- name: Generate changelog
if: ${{ github.ref == 'refs/heads/master' }}
uses: Bullrich/generate-release-changelog@master
id: changelog
env:
REPO: ${{ github.repository }}
- name: Get release version
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Create Release
if: ${{ github.ref == 'refs/heads/master' }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
body: |
${{ steps.changelog.outputs.changelog }}
- name: Set up QEMU
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: opencommercial/api:${{ env.RELEASE_VERSION }}