forked from codeboss-co/ChurchManagerApi
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (62 loc) · 2.75 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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