Skip to content

Instantly share code, notes, and snippets.

@alo9507
Created April 30, 2021 13:42
Show Gist options
  • Save alo9507/c10a20f934489667a7ee97bf2c084b88 to your computer and use it in GitHub Desktop.
Save alo9507/c10a20f934489667a7ee97bf2c084b88 to your computer and use it in GitHub Desktop.
name: OctoBay API - Test, Build, Push, Deploy
on:
push:
branches: [ development ]
pull_request:
branches: [ development ]
jobs:
build-and-push:
name: Build and Push Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Build & push docker image
env:
TAG: ${{ steps.date.outputs.date }}
run: |
docker build -t octobay/api:$TAG .
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker push octobay/api:$TAG
deploy:
name: Deploy to Kubernetes
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create kubeconfig
run: |
mkdir ${HOME}/.kube
echo ${{ secrets.KUBE_CONFIG }} | base64 --decode > ${HOME}/.kube/config
- name: Use context
run: kubectl config use-context octobay-api
- name: Deploy to K8s
run: kubectl apply -f k8s/
@neethalokanath
Copy link

Hi, can i know how $TAG variable is passed in deployment.yml file under k8s/ ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment