Update deployment.yaml #83
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: [push] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
registry: https://registry-intl.cn-hangzhou.aliyuncs.com | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./build/Dockerfile | |
push: true | |
tags: registry-intl.cn-hangzhou.aliyuncs.com/fachrin/fachrin:latest | |
deploy: | |
name: Production Deployment | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v3 | |
- name: Prepare Deployment Source | |
run: | | |
sed -ie "s/{{build_date}}/$(date)/g" deployment.yaml | |
- name: Trigger Deployment | |
uses: actions-hub/kubectl@v1.29.0 | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_DATA }} | |
with: | |
args: apply -f deployment.yaml --validate=false |