-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (38 loc) · 1.53 KB
/
micro-ci-events.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
name: ESGI Micro CI Events
on: [push, pull_request]
jobs:
build:
name: Build Micro CI Events Project
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v1
# Add your build steps here
- name: Build the docker-compose stack
run: chmod +x start_service.sh && ./start_service.sh
- name: Check running containers
run: docker ps -a
# Uncomment and replace {userName} by your account folder name
deploy:
name: Build/Publish Docker Images to DockerHub & Deploy to Azure VM
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout Project
uses: actions/checkout@v1
- name: Build & Publish Docker Image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: esgimicroci/al1-events
tag_with_ref: true
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure CLI script
uses: azure/CLI@v1
with:
inlineScript: |
az vm run-command invoke -g ${{ secrets.AZURE_RESOURCE_GRP }} -n ${{ secrets.AZURE_VM }} --command-id RunShellScript --scripts "cd /home/micro-ci-al1/micro-ci-events && wget -q https://raw.githubusercontent.com/esgi-microservices-al1/micro-ci-events/master/.github/azure/docker-compose.yml -O docker-compose.yml.yml && docker-compose.yml stop && docker-compose.yml rm && docker-compose.yml up -d"