Skip to content

HAI-1527 Rename role to kayttooikeustaso (#395) #281

HAI-1527 Rename role to kayttooikeustaso (#395)

HAI-1527 Rename role to kayttooikeustaso (#395) #281

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 }}'