updated jelastic env #10
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
name: Deploy to Jelastic | |
concurrency: 'Deploy to Jelastic' | |
on: | |
push: | |
branches: | |
- develop | |
- master | |
workflow_dispatch: | |
# Global environment variables | |
env: | |
REPOSITORY: churchmanager-api | |
jobs: | |
build: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛒 Checkout | |
uses: actions/checkout@v2 | |
- name: ⚙️ Set env to Test | |
if: endsWith(github.ref, '/develop') || contains(github.ref, 'feature') | |
run: | | |
echo "ENVIRONMENT=Test" >> $GITHUB_ENV | |
- name: ⚙️ Set env to Production | |
if: endsWith(github.ref, '/master') | |
run: | | |
echo "ENVIRONMENT=Production" >> $GITHUB_ENV | |
- name: ⚙️ Set current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y%m%d')" | |
- name: 🛠️ Update BuildInfo version | |
id: build-info | |
env: | |
VERSION: ${{ steps.date.outputs.date }}-${{ github.run_number }}-${{ env.ENVIRONMENT }} | |
run: | | |
printf '{"version":"%s"}' $VERSION > ./buildinfo.json | |
cat ./buildinfo.json # just some logging | |
working-directory: ./src/API/ChurchManager.Api | |
- name: 🛠️ Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: 🛠️ Build, tag, and push image to Docker Hub | |
id: build-image | |
env: | |
REGISTRY: godcode | |
REPOSITORY: ${{ env.REPOSITORY }} | |
IMAGE_TAG: ${{ steps.date.outputs.date }}-${{ github.run_number }} | |
run: | | |
# Build & push a docker container to ECR. | |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . | |
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG | |
echo "::set-output name=image::$REGISTRY/$REPOSITORY:$IMAGE_TAG" | |
echo "::set-output name=tag::$IMAGE_TAG" | |
- name: ⏭ Deploy to Jelastic | |
uses: fjogeleit/http-request-action@master | |
with: | |
url: https://app.my.mamazala.cloud/1.0/environment/control/rest/redeploycontainers?envName=${{ env.REPOSITORY }}-${{ env.ENVIRONMENT }}&session=${{ secrets.JELASTIC_ACCESS_TOKEN }}&tag=${{ steps.build-image.outputs.tag }}&nodeGroup=cp | |
# TODO: fix jelastic naming when creating environments | |
# url: https://app.my.mamazala.cloud/1.0/environment/control/rest/redeploycontainers?envName=cm-prod&session=${{ secrets.JELASTIC_ACCESS_TOKEN }}&tag=${{ steps.build-image.outputs.tag }}&nodeGroup=cp | |
method: 'POST' | |
timeout: 600000 #10mins |