-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move docker build to github workflow
- Loading branch information
Showing
2 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
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' | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
derhuerst
Contributor
|
||
runs-on: ubuntu-latest | ||
needs: [ tests ] | ||
env: | ||
CONTAINER_REPO: docker.io/entur/lamassu | ||
CONTAINER_REGISTRY_USER: ${{ secrets.DOCKERHUB_LOGIN }} | ||
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: temurin | ||
cache: maven | ||
|
||
- name: Build container image with Jib, push to Github 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 |
@testower FYI: This does not check if the push has happened on
master
, instead it will build & publish every branch as:latest
!