-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (80 loc) · 3.12 KB
/
release.yml
File metadata and controls
88 lines (80 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#
# 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/setup-java@v1.4.3
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
GITHUB_OAUTH_CLIENT_ID: 12345678901234567890
GITHUB_OAUTH_CLIENT_SECRET: 1234567890123456789012345678901234567890
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