Get git branch name

This commit is contained in:
David Sanz 2020-12-23 11:22:12 +01:00
parent 39df5985ac
commit 475e07b93c

View File

@ -14,18 +14,9 @@ env:
registryEndpoint: registryEndpoint:
services: basket-api services: basket-api
image: basket.api image: basket.api
branch: $(echo ${GITHUB_REF#refs/heads/}) # branch: $(echo ${GITHUB_REF#refs/heads/})
jobs: jobs:
# login:
# runs-on: ubuntu-latest
# steps:
# - name: Login to Container Registry
# uses: docker/login-action@v1
# with:
# registry: ${{ env.registryEndpoint }}
# username: ${{ secrets.USERNAME }}
# password: ${{ secrets.PASSWORD }}
BuildContainersForPR_Linux: BuildContainersForPR_Linux:
runs-on: ubuntu-16.04 runs-on: ubuntu-16.04
if: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name == 'pull_request' }}
@ -63,8 +54,18 @@ jobs:
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }} password: ${{ secrets.PASSWORD }}
- name: Get branch name
run: |
currentbranch=$(echo ${GITHUB_REF#refs/heads/})
echo $currentbranch
echo "branch=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Compose build ${{ env.services }} - name: Compose build ${{ env.services }}
run: sudo docker-compose -f src/docker-compose.yml build ${{ env.services }} run: |
echo "A initial message"
sudo docker-compose -f src/docker-compose.yml build ${{ env.services }}
docker images
shell: bash shell: bash
env: env:
TAG: ${{ env.branch }} TAG: ${{ env.branch }}