main.yml 901 Bytes
Newer Older
carlosribas's avatar
carlosribas committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
name: Building Docker containers

# Triggers the workflow on push or pull request events
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: docker login
        env:
          DOCKER_USER: ${{ secrets.DOCKER_USER }}
          DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
        run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

      - name: Get branch name
        if: github.event_name != 'pull_request'
        shell: bash
        run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

      - name: docker build
        if: env.BRANCH_NAME != ''
carlosribas's avatar
carlosribas committed
25
        run: docker build -f Dockerfile -t rnacentral/rnacentral-webcode:${{ env.BRANCH_NAME }} .
carlosribas's avatar
carlosribas committed
26 27 28 29

      - name: docker push
        if: env.BRANCH_NAME != ''
        run: docker push rnacentral/rnacentral-webcode:${{ env.BRANCH_NAME }}