-
Notifications
You must be signed in to change notification settings - Fork 5
87 lines (84 loc) · 2.8 KB
/
hanke-service-dev.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
name: hanke-service-dev
env:
GRADLE_MODULE: services:hanke-service
MODULE_PATH: services/hanke-service
ARTIFACT_NAME: hanke-service
on:
push:
branches:
- dev
paths:
- services/hanke-service/**
- .github/workflows/hanke-service-dev.yml
jobs:
build:
name: Gradle Build
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build with Gradle
run: ./gradlew :${{ env.GRADLE_MODULE }}:build :${{ env.GRADLE_MODULE }}:integrationTest
- name: Upload application jar file for Docker build job
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}-jar
path: ./${{ env.MODULE_PATH }}/build/libs/${{ env.ARTIFACT_NAME }}-*.jar
retention-days: 1
docker_build_and_push:
name: Build and push Docker image to GitHub container registry
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Download application jar file
uses: actions/download-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}-jar
- name: List files after checkout
shell: bash
run: |
ls -ltra
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to OpenShift Container Registry
uses: docker/login-action@v1
with:
registry: registry.redhat.io
username: ${{ secrets.RHSA_USERNAME }}
password: ${{ secrets.RHSA_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_OWNER }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./${{ env.MODULE_PATH }}/Dockerfile
push: true
tags: |
ghcr.io/city-of-helsinki/haitaton/${{ env.ARTIFACT_NAME }}:latest
ghcr.io/city-of-helsinki/haitaton/${{ env.ARTIFACT_NAME }}:dev
# - uses: Azure/pipelines@v1
# with:
# azure-devops-project-url: 'https://dev.azure.com/City-of-Helsinki/haitaton'
# azure-pipeline-name: 'City-of-Helsinki.haitaton-backend'
# azure-devops-token: '${{ secrets.AZURE_DEVOPS_TOKEN }}'