Update pull.yml #331
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
# | |
# 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: breedbase build | |
on: | |
push: | |
branches: | |
- develop | |
- master | |
- release/** | |
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: Get release version | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: get-latest-tag | |
- name: Update version | |
run: sed -i -E "s/^version .*/version ${{ steps.get-latest-tag.outputs.tag }}-$GITHUB_RUN_NUMBER/" sgn.conf | |
- name: Update version info | |
run: sed -i -E "s/^version_updated .*/version_updated ${{ github.event.repository.updated_at}}/" sgn.conf | |
- name: Commit sgn.conf | |
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 | |
build: | |
needs: version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free up space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Get the sgn repo | |
uses: actions/checkout@v2 | |
# - name: Get release version | |
# uses: actions-ecosystem/action-get-latest-tag@v1 | |
# id: get-latest-tag | |
- name: Extract branch name | |
shell: bash | |
run: echo ::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/}) | |
id: extract_branch | |
- name: Get breedbase_dockerfile | |
if: steps.extract_branch.outputs.branch == 'develop' | |
uses: actions/checkout@master | |
with: | |
repository: Breeding-Insight/breedbase_dockerfile | |
path: breedbase_dockerfile | |
ref: 'develop' | |
submodules: 'recursive' | |
- name: Get breedbase_dockerfile | |
if: startsWith(steps.extract_branch.outputs.branch, 'release/') | |
uses: actions/checkout@master | |
with: | |
repository: Breeding-Insight/breedbase_dockerfile | |
path: breedbase_dockerfile | |
ref: ${{ steps.extract_branch.outputs.branch }} | |
submodules: 'recursive' | |
- name: Get breedbase_dockerfile | |
if: steps.extract_branch.outputs.branch == 'master' | |
uses: actions/checkout@master | |
with: | |
repository: Breeding-Insight/breedbase_dockerfile | |
path: breedbase_dockerfile | |
ref: 'master' | |
submodules: 'recursive' | |
- name: Get the submodules | |
working-directory: ./breedbase_dockerfile | |
run: git submodule update --init --recursive | |
- name: Set sgn origin | |
working-directory: ./breedbase_dockerfile/cxgn/sgn | |
run: | | |
git remote rm origin | |
git remote add origin git@github.com:Breeding-Insight/sgn.git | |
git remote update | |
- name: Checkout sgn branch | |
working-directory: ./breedbase_dockerfile/cxgn/sgn | |
run: | | |
git checkout -B ${{ steps.extract_branch.outputs.branch }} origin/${{ steps.extract_branch.outputs.branch }} | |
- name: Debug sgn branch | |
working-directory: ./breedbase_dockerfile/cxgn/sgn | |
run: git status | |
- name: Set tag | |
id: vars | |
run: echo ::set-output name=imageName::$(echo breedinginsight/breedbase:$(sed -nE "s/^version (.*)/\1/p" sgn.conf)) | |
- name: Build Docker and push image | |
working-directory: ./breedbase_dockerfile | |
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/breedbase:develop | |
docker push breedinginsight/breedbase:develop | |
- name: Tag master | |
if: steps.extract_branch.outputs.branch == 'master' | |
run: | | |
docker tag ${{steps.vars.outputs.imageName}} breedinginsight/breedbase:latest | |
docker push breedinginsight/breedbase:latest | |
- name: Tag release | |
if: contains(github.ref, '/release/') | |
run: | | |
docker tag ${{steps.vars.outputs.imageName}} breedinginsight/breedbase:rc | |
docker push breedinginsight/breedbase:rc |