Skip to content

Build Latest Docker #23

Build Latest Docker

Build Latest Docker #23

Workflow file for this run

#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Build Latest Docker
on:
release:
types: [published]
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: bidb
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo ::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/})
id: extract_branch
- run: git pull origin ${{steps.extract_branch.outputs.branch}}
- name: Set up JDK 13
uses: actions/[email protected]
with:
java-version: 13
- name: Build with Maven
run: mvn validate -B flyway:migrate clean install --file pom.xml --settings settings.xml
env:
DB_USER: postgres
DB_PASSWORD: postgres
DB_SERVER: localhost
DB_NAME: bidb
GITHUB_ACTOR: $GITHUB_ACTOR
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WEB_BASE_URL: http://localhost:8080
BRAPI_DEFAULT_URL: https://test-server.brapi.org
API_INTERNAL_TEST_PORT: 8081
JWT_SECRET: ${{ secrets.JWT_SECRET }}
OAUTH_CLIENT_ID: 123abc
OAUTH_CLIENT_SECRET: asdfljkhalkbaldsfjasdfi238497098asdf
BRAPI_REFERENCE_SOURCE: breedinginsight.org
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Get version
id: version
run: echo ::set-output name=version::$(echo $(sed -nE "s/version=(.*)/\1/p" src/main/resources/version.properties))
- name: Set tag
id: vars
run: echo ::set-output name=imageName::$(echo breedinginsight/biapi:${{steps.version.outputs.version}})
- name: Build Docker and push image
run: |
docker build . --file Dockerfile --tag ${{steps.vars.outputs.imageName}}
docker push ${{steps.vars.outputs.imageName}}
docker tag ${{steps.vars.outputs.imageName}} breedinginsight/biapi:latest
docker push breedinginsight/biapi:latest