-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (73 loc) · 2.81 KB
/
versioner-develop.yml
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
name: Versioning bi-web (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 }}\",/" package.json'
- name: Update version info
run: 'sed -i -E "s~\"versionInfo\": \".*~\"versionInfo\": \"https://github.com/Breeding-Insight/bi-web/commit/${{ github.sha }}\"~" package.json'
- name: Commit package.json
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
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: 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" package.json))
- name: Set tag
id: vars
run: echo ::set-output name=imageName::$(echo breedinginsight/biweb:$(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/biweb:develop
docker push breedinginsight/biweb:develop
- name: Tag release candidate
if: contains(github.ref, '/release/')
run: |
docker tag ${{steps.vars.outputs.imageName}} breedinginsight/biweb:rc
docker push breedinginsight/biweb:rc
- name: Tag alpha
if: contains(github.ref, '/future/')
run: |
docker tag ${{steps.vars.outputs.imageName}} breedinginsight/biweb:alpha
docker push breedinginsight/biweb:alpha