Skip to content

Merge pull request #429 from Breeding-Insight/release/1.0-develop #891

Merge pull request #429 from Breeding-Insight/release/1.0-develop

Merge pull request #429 from Breeding-Insight/release/1.0-develop #891

name: Versioning bi-api (develop)
on:
push:
branches:
- develop
- release/**
- future/**
workflow_dispatch:
jobs:
version:
if: github.actor != 'rob-ouser-bi'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Update version
run: sed -i -E "s/version=(v[0-9]*\.[0-9]*\.[0-9]*).*/version=\1+${{ github.run_number }}/" src/main/resources/version.properties
- name: Update version info
run: sed -i -E "s~versionInfo=.*~versionInfo=https://github.com/Breeding-Insight/bi-api/commit/${{ github.sha }}~" src/main/resources/version.properties
- name: Commit version.properties
run: |
git config --local user.email "bidevteam@cornell.edu"
git config --local user.name "rob-ouser-bi"
git add .
git commit -m "[autocommit] bumping build number"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.ROB_OUSER_TOKEN }}
branch: ${{ github.ref }}
force: true
docker:
needs: version
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
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:$(sed -nE "s/\+/-/p" <<< ${{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}}
- name: Tag develop
if: steps.extract_branch.outputs.branch == 'develop'
run: |
docker tag ${{steps.vars.outputs.imageName}} breedinginsight/biapi:develop
docker push breedinginsight/biapi:develop
- name: Tag release candidate
if: contains(github.ref, '/release/')
run: |
docker tag ${{steps.vars.outputs.imageName}} breedinginsight/biapi:rc
docker push breedinginsight/biapi:rc
- name: Tag alpha release
if: contains(github.ref, '/future/')
run: |
docker tag ${{steps.vars.outputs.imageName}} breedinginsight/biapi:alpha
docker push breedinginsight/biapi:alpha