2020-04-09 11:00:30 +02:00
|
|
|
name: Build, push and deploy Docker image
|
|
|
|
|
|
|
|
on:
|
2021-05-10 11:56:08 +02:00
|
|
|
push:
|
|
|
|
branch: [master]
|
2021-04-29 14:44:41 +02:00
|
|
|
release:
|
2021-04-29 18:44:46 +02:00
|
|
|
types: [created]
|
2021-04-26 15:14:21 +02:00
|
|
|
pull_request:
|
|
|
|
types: [ labeled, synchronize ]
|
|
|
|
|
2020-04-09 11:00:30 +02:00
|
|
|
|
|
|
|
# Enables BuildKit
|
|
|
|
env:
|
|
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build-front:
|
2021-05-10 11:56:08 +02:00
|
|
|
if: ${{ github.event.release || github.event.push || contains(github.event.pull_request.labels.*.name, 'deploy') }}
|
2020-04-09 11:00:30 +02:00
|
|
|
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
|
2020-11-17 18:27:33 +01:00
|
|
|
- uses: rlespinasse/github-slug-action@3.1.0
|
2020-04-13 18:15:27 +02:00
|
|
|
|
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-09-18 17:18:50 +02:00
|
|
|
path: ./
|
2020-04-09 11:00:30 +02:00
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: thecodingmachine/workadventure-front
|
2021-05-10 11:56:08 +02:00
|
|
|
tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || github.event.release && env.GITHUB_REF_SLUG || 'master' }}
|
2020-04-09 11:00:30 +02:00
|
|
|
add_git_labels: true
|
|
|
|
|
|
|
|
build-back:
|
2021-05-10 11:56:08 +02:00
|
|
|
if: ${{ github.event.release || github.event.push || contains(github.event.pull_request.labels.*.name, 'deploy') }}
|
2020-04-09 11:00:30 +02:00
|
|
|
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
|
2020-12-04 15:13:35 +01:00
|
|
|
- uses: rlespinasse/github-slug-action@3.1.0
|
|
|
|
|
|
|
|
- name: "Build and push back image"
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
|
|
|
dockerfile: back/Dockerfile
|
|
|
|
path: ./
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: thecodingmachine/workadventure-back
|
2021-05-10 11:56:08 +02:00
|
|
|
tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || github.event.release && env.GITHUB_REF_SLUG || 'master' }}
|
2020-12-04 15:13:35 +01:00
|
|
|
add_git_labels: true
|
|
|
|
|
|
|
|
build-pusher:
|
2021-05-10 11:56:08 +02:00
|
|
|
if: ${{ github.event.release || github.event.push || contains(github.event.pull_request.labels.*.name, 'deploy') }}
|
2020-12-04 15:13:35 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# Create a slugified value of the branch
|
|
|
|
- uses: rlespinasse/github-slug-action@3.1.0
|
2020-04-13 18:15:27 +02:00
|
|
|
|
2020-04-09 11:00:30 +02:00
|
|
|
- name: "Build and push back image"
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
2020-12-09 15:19:22 +01:00
|
|
|
dockerfile: pusher/Dockerfile
|
2020-09-18 17:18:50 +02:00
|
|
|
path: ./
|
2020-04-09 11:00:30 +02:00
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2020-12-09 15:19:22 +01:00
|
|
|
repository: thecodingmachine/workadventure-pusher
|
2021-05-10 11:56:08 +02:00
|
|
|
tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || github.event.release && env.GITHUB_REF_SLUG || 'master' }}
|
2020-06-01 16:12:48 +02:00
|
|
|
add_git_labels: true
|
|
|
|
|
2020-12-09 21:29:29 +01:00
|
|
|
build-uploader:
|
2021-05-10 11:56:08 +02:00
|
|
|
if: ${{ github.event.release || github.event.push || contains(github.event.pull_request.labels.*.name, 'deploy') }}
|
2020-12-09 21:29:29 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# Create a slugified value of the branch
|
|
|
|
- uses: rlespinasse/github-slug-action@3.1.0
|
|
|
|
|
|
|
|
- name: "Build and push back image"
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
|
|
|
dockerfile: uploader/Dockerfile
|
|
|
|
path: ./
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: thecodingmachine/workadventure-uploader
|
2021-05-10 11:56:08 +02:00
|
|
|
tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || github.event.release && env.GITHUB_REF_SLUG || 'master' }}
|
2020-12-09 21:29:29 +01:00
|
|
|
add_git_labels: true
|
|
|
|
|
2020-07-23 18:43:51 +02:00
|
|
|
build-maps:
|
2021-05-10 11:56:08 +02:00
|
|
|
if: ${{ github.event.release || github.event.push || contains(github.event.pull_request.labels.*.name, 'deploy') }}
|
2020-07-23 18:43:51 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
|
|
|
|
# Create a slugified value of the branch
|
2020-12-04 15:13:35 +01:00
|
|
|
- uses: rlespinasse/github-slug-action@3.1.0
|
2020-07-23 18:43:51 +02:00
|
|
|
|
|
|
|
- name: "Build and push front image"
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
|
|
|
dockerfile: maps/Dockerfile
|
|
|
|
path: maps/
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: thecodingmachine/workadventure-maps
|
2021-05-10 11:56:08 +02:00
|
|
|
tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || github.event.release && env.GITHUB_REF_SLUG || 'master' }}
|
2020-04-09 11:00:30 +02:00
|
|
|
add_git_labels: true
|
|
|
|
|
|
|
|
deeploy:
|
|
|
|
needs:
|
|
|
|
- build-front
|
|
|
|
- build-back
|
2020-12-11 12:37:11 +01:00
|
|
|
- build-pusher
|
|
|
|
- build-maps
|
|
|
|
- build-uploader
|
2020-04-09 11:00:30 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-10 11:56:08 +02:00
|
|
|
if: ${{ github.event.push || contains(github.event.pull_request.labels.*.name, 'deploy') }}
|
2020-04-09 11:00:30 +02:00
|
|
|
|
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
|
2020-12-09 13:50:18 +01:00
|
|
|
- uses: rlespinasse/github-slug-action@3.1.0
|
2020-04-13 15:44:33 +02:00
|
|
|
|
2020-04-09 12:14:06 +02:00
|
|
|
- name: Deploy
|
2020-12-18 17:04:31 +01:00
|
|
|
uses: thecodingmachine/deeployer-action@master
|
2020-04-09 14:21:43 +02:00
|
|
|
env:
|
|
|
|
KUBE_CONFIG_FILE: ${{ secrets.KUBE_CONFIG_FILE }}
|
2020-10-14 12:25:05 +02:00
|
|
|
ADMIN_API_TOKEN: ${{ secrets.ADMIN_API_TOKEN }}
|
2020-10-19 12:07:05 +02:00
|
|
|
JITSI_ISS: ${{ secrets.JITSI_ISS }}
|
|
|
|
JITSI_URL: ${{ secrets.JITSI_URL }}
|
|
|
|
SECRET_JITSI_KEY: ${{ secrets.SECRET_JITSI_KEY }}
|
2021-02-16 11:34:12 +01:00
|
|
|
TURN_STATIC_AUTH_SECRET: ${{ secrets.TURN_STATIC_AUTH_SECRET }}
|
2021-05-10 11:56:08 +02:00
|
|
|
DEPLOY_REF: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || 'master' }}
|
2020-04-09 12:14:06 +02:00
|
|
|
with:
|
2021-05-10 11:56:08 +02:00
|
|
|
namespace: workadventure-${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || 'master' }}
|
2020-04-13 18:30:22 +02:00
|
|
|
|
|
|
|
- name: Add a comment in PR
|
2020-04-13 18:33:27 +02:00
|
|
|
uses: unsplash/comment-on-pr@v1.2.0
|
2021-05-10 11:56:08 +02:00
|
|
|
if: ${{ github.event.pull_request }}
|
2020-04-13 18:30:22 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2021-04-27 17:47:12 +02:00
|
|
|
msg: Environment deployed at https://play.${{ env.GITHUB_HEAD_REF_SLUG }}.test.workadventu.re
|