Skip to content

Merge pull request #57 from Killerrekt/master #68

Merge pull request #57 from Killerrekt/master

Merge pull request #57 from Killerrekt/master #68

Workflow file for this run

name: Publish Docker Image to Docker Hub
on:
push:
branches:
- master # Change this to the branch you want to trigger on
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: "Create env file"
run: |
echo "${{ secrets.ENV_FILE }}" > .env
cat .env
- name: Build and push Docker image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker buildx create --use
docker buildx build --push -t $DOCKER_USERNAME/cookoff:latest .
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cookoff-cluster
- name: Deploy to DigitalOcean Kubernetes
run: kubectl apply -f deployment.yaml
- name: Rollout DigitalOcean Kubernetes
run: kubectl rollout restart deployment cookooff-backend-deployment
- name: Pod Status
run: kubectl get pods
- name: Verify deployment
run: kubectl rollout status deployment/cookooff-backend-deployment