Skip to content

Merge pull request #1406 from hiqedme/EID-Mappings #155

Merge pull request #1406 from hiqedme/EID-Mappings

Merge pull request #1406 from hiqedme/EID-Mappings #155

# Build, publish & deploy $branch
name: Deploy test-build
on:
push:
branches-ignore:
- 'master'
jobs:
build_and_publish:
name: build, publish, & deploy
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
# This is the a separate action that sets up buildx runner
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
# So now you can use Actions' own caching!
-
name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# And make it available for the builds
-
name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: docker/etl-rest-server/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ampathke/etl-services:${{ steps.extract_branch.outputs.branch }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# This ugly bit is necessary if you don't want your cache to grow forever
# till it hits GitHub's limit of 5GB.
# Temp fix
-
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
-
name: Spin up ETL nomad job
uses: fjogeleit/http-request-action@master
with:
url: https://${{ secrets.AMPATH_CI_HOST }}/levant/deploy?branch=${{ steps.extract_branch.outputs.branch }}
method: "GET"
customHeaders: '{ "Accept": "application/json", "Content-Type": "application/json" }'
-
name: Expose an external URL
uses: fjogeleit/http-request-action@master
with:
url: https://${{ secrets.AMPATH_CI_HOST }}/etl?branch=${{ steps.extract_branch.outputs.branch }}
method: "GET"
customHeaders: '{ "Accept": "application/json", "Content-Type": "application/json" }'