Skip to content

Deploy graham-nano #116

Deploy graham-nano

Deploy graham-nano #116

Workflow file for this run

name: CI
on:
push:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v2
- 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: |
python -m unittest test/*.py
build_and_publish:
name: Build and Publish Docker Image
needs: test
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/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }} .
- name: Push image
if: success()
uses: actions-hub/docker@master
with:
args: push bananocoin/graham:${{ env.BRANCH_NAME }}-${{ env.GITHUB_RUN_ID }}
deploy_bbet:
name: Deploy banano bet 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.x'
- 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/bbet
run: |
kustomize edit set image replaceme=bananocoin/graham:${{ 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/bbet/deployment-k.yaml
deploy_nano:
name: Deploy nano discord bot
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.x'
- 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/nano
run: |
kustomize edit set image replaceme=bananocoin/graham:${{ 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/nano/deployment-k.yaml
# deploy_graham_banano:
# name: Deploy graham bot (banano)
# 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.x"
# - 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/graham_banano
# run: |
# kustomize edit set image replaceme=bananocoin/graham:${{ 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/graham_banano/deployment-k.yaml
# deploy_bananobot:
# name: Deploy BananoBot++
# 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.x"
# - 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/bananobot
# run: |
# kustomize edit set image replaceme=bananocoin/graham:${{ 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/bananobot/deployment-k.yaml