102 lines
3.0 KiB
YAML
Raw Normal View History

2020-12-22 13:53:57 +01:00
name: basket-api
2020-12-22 13:45:30 +01:00
on:
push:
branches:
- master
- dev
2020-12-22 13:55:24 +01:00
- feature/github-actions
2020-12-22 13:45:30 +01:00
paths:
- src/BuildingBlocks/*
- src/Services/Basket/*
2020-12-22 13:53:57 +01:00
- .github/workflows/basket-api.yml
2020-12-22 13:45:30 +01:00
env:
2020-12-23 11:53:39 +01:00
registryEndpoint: hub.docker.com/repository/docker/borjasanes/eshoponcontainers
2020-12-22 13:45:30 +01:00
services: basket-api
image: basket.api
2020-12-23 11:22:12 +01:00
# branch: $(echo ${GITHUB_REF#refs/heads/})
2020-12-23 10:19:10 +01:00
2020-12-22 13:45:30 +01:00
jobs:
BuildContainersForPR_Linux:
runs-on: ubuntu-16.04
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Compose build ${{ env.services }}
run: docker-compose build -f src/docker-compose.yml ${{ env.services }}
shell: bash
env:
TAG: ${{ env.branch }}
REGISTRY: ${{ env.registryEndpoint }}
BuildContainersForPR_Windows:
runs-on: windows-2019
if: ${{ false }}
# if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Compose build ${{ env.services }}
run: docker-compose build -f src/docker-compose.yml ${{ env.services }}
shell: pwsh
env:
TAG: ${{ env.branch }}
REGISTRY: ${{ env.registryEndpoint }}
PLATFORM: win
NODE_IMAGE: stefanscherer/node-windows:10
BuildLinux:
2020-12-22 17:12:21 +01:00
runs-on: ubuntu-latest
2020-12-22 13:45:30 +01:00
if: ${{ github.event_name != 'pull_request' }}
steps:
2020-12-22 16:42:30 +01:00
- name: 'Checkout Github Action'
uses: actions/checkout@master
2020-12-23 10:19:10 +01:00
2020-12-22 16:56:17 +01:00
- name: Login to Container Registry
2020-12-22 17:09:43 +01:00
uses: docker/login-action@v1
with:
2020-12-23 11:55:51 +01:00
registry:
2020-12-22 17:09:43 +01:00
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
2020-12-23 10:19:10 +01:00
2020-12-23 11:22:12 +01:00
- name: Get branch name
run: |
2020-12-23 11:32:44 +01:00
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
2020-12-23 11:22:12 +01:00
echo "branch=$currentbranch" >> $GITHUB_ENV
2020-12-23 15:42:55 +01:00
echo "TAG=$currentbranch" >> $GITHUB_ENV
2020-12-23 11:22:12 +01:00
shell: bash
2020-12-23 15:42:55 +01:00
- name: Compose build ${{ env.services }}
2020-12-23 11:37:47 +01:00
run: |
2020-12-23 11:53:39 +01:00
echo "running on ${{ env.branch }}"
2020-12-23 12:14:13 +01:00
echo "TAG: ${{ env.TAG }}"
echo "REGISTRY: ${{ env.REGISTRY }}"
2020-12-23 16:23:09 +01:00
export TAG=experimental
sudo -E docker-compose build ${{ env.services }}
2020-12-23 11:37:47 +01:00
docker images
2020-12-23 15:42:55 +01:00
working-directory: ./src
2020-12-23 11:37:47 +01:00
shell: bash
env:
2020-12-23 15:42:55 +01:00
# TAG: ${{ env.branch }}
2020-12-23 11:37:47 +01:00
REGISTRY: ${{ env.registryEndpoint }}
2020-12-23 10:19:10 +01:00
2020-12-23 16:06:47 +01:00
# - name: Compose push ${{ env.image }}
# run: sudo docker-compose -f src/docker-compose.yml push ${{ env.services }}
# shell: bash
# env:
# TAG: ${{ env.branch }}
# REGISTRY: ${{ env.registryEndpoint }}
2020-12-23 10:19:10 +01:00
2020-12-22 13:45:30 +01:00
BuildWindows:
runs-on: windows-2019
if: ${{ false }}
# if: ${{ github.event_name != 'pull_request' }}
steps:
2020-12-22 13:49:52 +01:00
- name: Compose build ${{ env.services }}
2020-12-22 13:45:30 +01:00
run: docker-compose build -f src/docker-compose.yml ${{ env.services }}
shell: pwsh
env:
TAG: ${{ env.branch }}
REGISTRY: ${{ env.registryEndpoint }}
- name: Compose push ${{ env.image }}
run: docker-compose push -f src/docker-compose.yml ${{ env.services }}'
shell: pwsh
env:
TAG: ${{ env.branch }}
REGISTRY: ${{ env.registryEndpoint }}