Skip to content

Commit

Permalink
ci: Integrate deployment pipeline workflow (#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliouzbett authored Aug 6, 2021
1 parent 4db0271 commit c02cd9e
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/deploy-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy beta
on:
push:
branches: [master]
jobs:
docker:
name: Build Publish and Deploy Beta
runs-on: ubuntu-latest
steps:
-
name: Check Out Repo
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
-
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: 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:beta
-
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" }'

77 changes: 77 additions & 0 deletions .github/workflows/deploy-test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Build, publish & deploy $branch
name: Deploy test-build
on:
create:
branches: '*'
jobs:
docker:
name: Build Publish and Deploy
runs-on: ubuntu-latest
steps:
# Check out code
-
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" }'
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ conf/config-bk.json
dist
build
.build
.github/workflows/

0 comments on commit c02cd9e

Please sign in to comment.