deploy: 10th deployment (#145) #52
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: deploy-order | |
on: | |
push: | |
# watch for pull request into main branch | |
branches: | |
- main | |
# watch for changes in order folder | |
paths: | |
- "order/**" | |
- "trigger-deploy.txt" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# build an image | |
- run: cd order && docker build -t thasup/order . | |
# login on docker hub | |
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
# push an image to docker hub | |
- run: docker push thasup/order | |
# use and cliententicate doctl | |
- uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
# give credential to k8s cluster | |
- run: doctl kubernetes cluster kubeconfig save my-9th-aurapan-cluster | |
# restart deployment | |
- run: kubectl rollout restart deployment order-depl |