[autocommit] bumping build number #804
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
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 |