diff --git a/.github/workflows/basket-api.yml b/.github/workflows/basket-api.yml index 7caeaadaf..f41894b7e 100644 --- a/.github/workflows/basket-api.yml +++ b/.github/workflows/basket-api.yml @@ -16,25 +16,15 @@ on: - master - dev env: - REGISTRY_ENDPOINT: eshop + REGISTRY_ENDPOINT: borjasanes REGISTRY_HOST: docker.io SERVICES: basket-api jobs: - GetImageTag: - runs-on: ubuntu-latest - steps: - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - BuildContainersForPR_Linux: runs-on: ubuntu-latest - #if: ${{ github.event_name == 'pull_request' }} + if: ${{ github.event_name == 'pull_request' }} steps: - name: 'Checkout Github Action' uses: actions/checkout@master @@ -74,6 +64,13 @@ jobs: username: ${{ secrets.USERNAME }} password: ${{ secrets.PASSWORD }} + - name: Set branch name as env variable + run: | + currentbranch=$(echo ${GITHUB_REF##*/}) + echo "running on $currentbranch" + echo "BRANCH=$currentbranch" >> $GITHUB_ENV + shell: bash + - name: Compose build ${{ env.SERVICES }} run: sudo -E docker-compose build ${{ env.SERVICES }} working-directory: ./src @@ -92,15 +89,28 @@ jobs: BuildWindows: runs-on: windows-2019 - if: ${{ false }} - # if: ${{ github.event_name != 'pull_request' }} + # if: ${{ false }} + if: ${{ github.event_name != 'pull_request' }} steps: + + - name: Login to Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY_HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + + - name: Set branch name as env variable + shell: pwsh + run: echo $Env:GITHUB_REF -replace "refs/heads/", "" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + - name: Compose build ${{ env.SERVICES }} run: docker-compose build -f src/docker-compose.yml ${{ env.SERVICES }} shell: pwsh env: TAG: ${{ env.BRANCH }} REGISTRY: ${{ env.REGISTRY_ENDPOINT }} + - name: Compose push ${{ env.SERVICES }} run: docker-compose push -f src/docker-compose.yml ${{ env.SERVICES }}' shell: pwsh