workadventure/.github/workflows/build-and-deploy.yml

86 lines
2.1 KiB
YAML
Raw Normal View History

2020-04-09 11:00:30 +02:00
name: Build, push and deploy Docker image
on:
- push
2020-04-09 11:00:30 +02:00
# Enables BuildKit
env:
DOCKER_BUILDKIT: 1
jobs:
build-front:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2020-04-13 18:15:27 +02:00
# Create a slugified value of the branch
- uses: rlespinasse/github-slug-action@master
2020-04-09 11:00:30 +02:00
- name: "Build and push front image"
uses: docker/build-push-action@v1
with:
2020-04-09 11:56:29 +02:00
dockerfile: front/Dockerfile
2020-04-13 14:46:45 +02:00
path: front/
2020-04-09 11:00:30 +02:00
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-front
2020-04-13 18:15:27 +02:00
tags: ${{ env.GITHUB_REF_SLUG }}
2020-04-09 11:00:30 +02:00
add_git_labels: true
build-back:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2020-04-13 18:15:27 +02:00
# Create a slugified value of the branch
- uses: rlespinasse/github-slug-action@master
2020-04-09 11:00:30 +02:00
- name: "Build and push back image"
uses: docker/build-push-action@v1
with:
2020-04-09 11:56:29 +02:00
dockerfile: back/Dockerfile
2020-04-13 14:46:45 +02:00
path: back/
2020-04-09 11:00:30 +02:00
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-back
2020-04-13 18:15:27 +02:00
tags: ${{ env.GITHUB_REF_SLUG }}
2020-04-09 11:00:30 +02:00
add_git_labels: true
deeploy:
needs:
- build-front
- build-back
runs-on: ubuntu-latest
2020-04-09 11:03:24 +02:00
steps:
2020-04-09 11:00:30 +02:00
- name: Checkout
uses: actions/checkout@v2
2020-04-13 15:44:33 +02:00
# Create a slugified value of the branch
- uses: rlespinasse/github-slug-action@master
2020-04-09 12:14:06 +02:00
- name: Deploy
2020-04-09 11:00:30 +02:00
uses: thecodingmachine/deeployer@master
2020-04-09 14:21:43 +02:00
env:
KUBE_CONFIG_FILE: ${{ secrets.KUBE_CONFIG_FILE }}
2020-04-09 12:14:06 +02:00
with:
2020-04-13 15:45:35 +02:00
namespace: workadventure-${{ env.GITHUB_REF_SLUG }}
- name: Add a comment in PR
uses: unsplash/comment-on-pr@1.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: Environment deployed at http://${{ env.GITHUB_REF_SLUG }}.workadventure.test.thecodingmachine.com
check_for_duplicate_msg: true