-
-
Notifications
You must be signed in to change notification settings - Fork 354
74 lines (72 loc) · 2.84 KB
/
build-on-push.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
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
postgresql: ['10','15']
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Build with Gradle
run: ./gradlew dist jacocoTestReport -Dpgsql.version=${{ matrix.postgresql }}
- name: upload to sonarcloud
if: ${{ github.repository == 'alfio-event/alf.io' && matrix.postgresql == '14'}}
run: ./gradlew sonarqube
env:
SONARCLOUD_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Upload Build'
if: ${{ github.repository == 'alfio-event/alf.io' && matrix.postgresql == '10'}}
uses: actions/upload-artifact@v3
with:
name: dist
path: build
retention-days: 5
push_image:
runs-on: ubuntu-latest
if: ${{ github.repository == 'alfio-event/alf.io' && github.event_name == 'push' }}
needs: build
name: Push dev image
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Configure Docker
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Push Docker image
uses: docker/build-push-action@v4
with:
context: ./dockerize
tags: |
ghcr.io/alfio-event/alf.io/dev-${{ env.GITHUB_REF_SLUG }}:latest
platforms: linux/amd64,linux/arm64
push: true