-
Notifications
You must be signed in to change notification settings - Fork 11
72 lines (70 loc) · 2.65 KB
/
pull.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
name: Docker Image CI Pull
on:
pull_request:
branches:
- main
- development
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- name: Default Environment Variables
run:
echo "https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables";
echo "GITHUB_WORKFLOW is $GITHUB_WORKFLOW";
echo "GITHUB_WORKFLOW_REF is $GITHUB_WORKFLOW_REF";
echo "GITHUB_RUN_ATTEMPT is $GITHUB_RUN_ATTEMPT";
echo "GITHUB_REF is $GITHUB_REF";
echo "GITHUB_REF_NAME is $GITHUB_REF_NAME";
echo "GITHUB_REF_PROTECTED is $GITHUB_REF_PROTECTED";
echo "GITHUB_HEAD_REF is $GITHUB_HEAD_REF";
echo "GITHUB_BASE_REF is $GITHUB_BASE_REF";
- name: Create vendor folder
run: |
mkdir api/vendor
chmod +777 api/vendor
chmod +777 -R api/public
- name: Setting APP_NAME
run: |
export NAME=$(grep APP_NAME= .env | cut -d '=' -f2)
echo "APP_NAME=$NAME" >> $GITHUB_ENV
- name: Print app name
run: echo "APP_NAME = $APP_NAME"
- name: Setting APP_ENV to dev
run: |
echo "APP_ENV=dev">> $GITHUB_ENV
echo "set APP_ENV to $APP_ENV"
- name: Setting APP_ENV to prod
if: contains( github.ref, 'main' ) || contains( github.base_ref, 'main' )
run: |
echo "APP_ENV=prod">> $GITHUB_ENV
echo "set APP_ENV to $APP_ENV"
- name: Print definitive APP_ENV
run: echo "APP_ENV is now $APP_ENV and APP_BUILD is now $APP_BUILD"
- name: Build the Docker image
run: docker-compose build --build-arg APP_ENV=$APP_ENV --build-arg APP_BUILD=$APP_BUILD --build-arg APP_BUILD_ALL_FIXTURES=true
- name: Run the docker image
run: docker-compose up -d
- name: Taking some sleep (for containers to come up)
run: sleep 120
- name: Check if all containers are running
run: docker ps
- name: Dumping the logs
run: docker-compose logs
- name: Database Update
run: docker-compose exec -T php bin/console doctrine:schema:update --force
- name: Create kube config
id: kubeconfig
if: contains( github.ref, 'development' )
run: |
if [ "${{ secrets.KUBECONFIG }}" != "" ]; then
printf "${{ secrets.KUBECONFIG }}" > kubeconfig.yaml
echo "##[set-output name=success]true"
else
echo "##[set-output name=success]false"
fi
- name: Chores
if: (success() || failure())
run: docker-compose down