Skip to content

Update deploy.yml

Update deploy.yml #126

Workflow file for this run

name: Deploy to AKS Cluster
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: Azure/docker-login@v1
with:
login-server: cmbrose.azurecr.io
username: ${{ secrets.ACR_ADMIN_USERNAME }}
password: ${{ secrets.ACR_ADMIN_PASSWORD }}
- run: |
docker build . -t cmbrose.azurecr.io/recipes:${{ github.sha }}
docker push cmbrose.azurecr.io/recipes:${{ github.sha }}
# Set the target AKS cluster.
- uses: Azure/aks-set-context@v1
with:
creds: "${{ secrets.AZURE_CREDENTIALS }}"
cluster-name: recipes-dev-aks
resource-group: recipes-svc-dev
- uses: Azure/k8s-create-secret@v1
with:
container-registry-url: cmbrose.azurecr.io
container-registry-username: ${{ secrets.ACR_ADMIN_USERNAME }}
container-registry-password: ${{ secrets.ACR_ADMIN_PASSWORD }}
secret-name: k8s-secret
- uses: Azure/k8s-create-secret@v1
with:
namespace: "default"
secret-type: "generic"
arguments: --from-literal=username=${{ secrets.DEV_DB_ADMIN_USERNAME }} --from-literal=password=${{ secrets.DEV_DB_ADMIN_PASSWORD }}
secret-name: db-credentials
- uses: Azure/k8s-create-secret@v1
with:
namespace: "default"
secret-type: "generic"
arguments: --from-literal=secret-key-base=${{ secrets.RAILS_SECRET_KEY_BASE }}
secret-name: rails-secrets
- name: Set up Ruby 2.7.2
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Migrate DB
env:
DB_USERNAME: ${{ secrets.DEV_DB_ADMIN_USERNAME }}
DB_PASSWORD: ${{ secrets.DEV_DB_ADMIN_PASSWORD }}
DB_SSL_CA_PATH: db_ssl
DB_SSL_CA: combined.crt.pem
SECRET_KEY_BASE: ${{ secrets.RAILS_SECRET_KEY_BASE }}
RAILS_ENV: production
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler -v 2.4.22
bundle install --jobs 4 --retry 3
bundle exec rails db:create
bundle exec rails db:migrate
- uses: Azure/k8s-deploy@v1
with:
manifests: |
deploy/manifests/deployment.yaml
deploy/manifests/service.yaml
images: |
cmbrose.azurecr.io/recipes:${{ github.sha }}
imagepullsecrets: |
k8s-secret