Deploy #3
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 | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install dependencies | |
run: yarn install | |
- name: Build project | |
run: yarn build | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to DigitalOcean | |
run: echo "${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}" | docker login -u "doctl" --password-stdin registry.digitalocean.com | |
- name: Build and push Docker image | |
run: | | |
docker buildx build --platform linux/amd64,linux/arm64 \ | |
--tag registry.digitalocean.com/dailybruin/dbonline:latest \ | |
--push . | |
- name: Install doctl | |
run: | | |
curl -sL https://github.com/digitalocean/doctl/releases/download/v1.99.0/doctl-1.99.0-linux-amd64.tar.gz | tar -xzv | |
sudo mv doctl /usr/local/bin/ | |
- name: Authenticate doctl | |
run: | | |
doctl auth init --access-token ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | |
- name: Write kubeconfig to file | |
run: | | |
echo "${{ secrets.KUBECONFIG }}" > kubeconfig.yaml | |
- name: Update Kubernetes deployment | |
env: | |
KUBECONFIG: kubeconfig.yaml | |
run: | | |
kubectl set image deployment/flamingo flamingo=registry.digitalocean.com/dailybruin/dbonline:latest | |
kubectl rollout status deployment/flamingo | |