forked from solgenomics/sgn
-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (139 loc) · 5.43 KB
/
build.yml
File metadata and controls
161 lines (139 loc) · 5.43 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#
# 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