forked from AMPATH/etl-rest-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Integrate deployment pipeline workflow (AMPATH#1091)
- Loading branch information
1 parent
4db0271
commit c02cd9e
Showing
3 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" }' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ conf/config-bk.json | |
dist | ||
build | ||
.build | ||
.github/workflows/ |