Skip to content

Bump the sentiment-api-gradle group in /sentiment-api with 2 updates #30

Bump the sentiment-api-gradle group in /sentiment-api with 2 updates

Bump the sentiment-api-gradle group in /sentiment-api with 2 updates #30

Workflow file for this run

name: sentiment-api
on:
push:
branches: [ main ]
paths:
- .github/workflows/sentiment-api.yaml
- sentiment-api/**
pull_request:
branches: [ main ]
paths:
- .github/workflows/sentiment-api.yaml
- sentiment-api/**
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/${{ github.repository }}/sentiment-api
GOOGLE_APPLICATION_CREDENTIALS: src/test/kotlin/no/nav/sentimentapi/resources/mock-google-credentials.json
defaults:
run:
working-directory: ./sentiment-api
jobs:
build:
name: Build and test Java application
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'
check-latest: true
- run: ./gradlew clean build --info
docker:
name: Build and push Docker image
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: version
run: echo "version=$(date +'%Y%m%d-%H%M%S')-$(git rev-parse --short HEAD)" >> ${GITHUB_OUTPUT}
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: metadata
with:
images: |
${{ env.IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=sha
type=raw,value=${{ steps.version.outputs.version }}
- uses: docker/build-push-action@v5
with:
context: ./sentiment-api
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
deploy-dev-gcp:
name: Deploy to dev-gcp
needs: [build, docker]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_FRONTEND_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: sentiment-api/.nais/nais.yaml
# VARS: sentiment-api/.nais/dev.yaml
IMAGE: ${{ env.IMAGE }}:${{ needs.docker.outputs.version }}