Skip to content

Fix config

Fix config #24

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
jobs:
# run_tests:
# name: Python Test
# runs-on: ubuntu-latest
# env:
# FLASK_DEBUG: 1
# FLASK_APP: autoapp.py
# APP_SECRET: 1234
# strategy:
# matrix:
# python-version: [3.7]
# steps:
# - uses: actions/checkout@master
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v1
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# - name: Run tests
# run: |
# echo "{}" > app/webpack/manifest.json
# flask test
build_and_publish:
name: Build and Publish Image
runs-on: ubuntu-latest
env:
GITHUB_RUN_ID: ${{ github.run_id }}
steps:
- uses: actions/checkout@master
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- name: Login to registry
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and tag
if: success()
run: docker build -t bananocoin/monkeytalks:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} .
- name: Push image
if: success()
uses: actions-hub/docker@master
with:
args: push bananocoin/monkeytalks:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
deploy_image:
name: Deploy app
needs: build_and_publish
runs-on: ubuntu-latest
env:
GITHUB_RUN_ID: ${{ github.run_id }}
steps:
- uses: actions/checkout@master
- uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.5.4"
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- name: Set image
working-directory: ./kubernetes
run: |
kustomize edit set image replaceme=bananocoin/monkeytalks:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
kustomize build . > deployment-k.yaml
- name: Deploy image to k8s cluster
uses: bbedward/kubectl@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: apply -f ./kubernetes/deployment-k.yaml