Skip to content

Commit

Permalink
adds github actions workflow config
Browse files Browse the repository at this point in the history
  • Loading branch information
assadriaz committed May 2, 2024
1 parent 7660413 commit 74ee46a
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI Build

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
tests:
runs-on: ubuntu-latest
env:
TZ: Europe/Oslo
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven

- name: Run tests
run: |
sudo timedatectl set-timezone "Europe/Oslo"
mvn --batch-mode test
image:
# only build and push the image when it's a commit to master in Entur's repository
if: github.repository_owner == 'entur' && github.event_name == 'push'
runs-on: ubuntu-latest
needs: [ tests ]
env:
CONTAINER_REPO: docker.io/entur/tiamat
CONTAINER_REGISTRY_USER: ${{ secrets.DOCKERHUB_LOGIN }}
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven

- name: Build container image with Jib, push to container repo
run: |
image_date=`date +%Y-%m-%dT%H-%M`
mvn --batch-mode compile com.google.cloud.tools:jib-maven-plugin:build -Djib.to.tags=latest,$image_date

0 comments on commit 74ee46a

Please sign in to comment.