Version updates #14
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
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build Docker images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout master | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: daanvm | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push christelmusic.nl-nginx | |
id: docker_build_christelmusic_nl_nginx | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile-nginx | |
push: true | |
tags: daanvm/christelmusic.nl-nginx:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build and push christelmusic.nl-php | |
id: docker_build_christelmusic_nl_php | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile-php | |
push: true | |
tags: daanvm/christelmusic.nl-php:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy-kubernetes: | |
name: Create Kubernetes resources | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout master | |
uses: actions/checkout@v3 | |
- 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 k8s-daanvm | |
- name: Create kubernetes resources | |
run: | | |
kubectl apply -f ./christelmusic.nl.yaml | |
- name: Deploy new latest version of docker image | |
run: | | |
kubectl create secret generic ifttt --save-config --dry-run=client --from-literal='key=${{ secrets.IFTTT_KEY }}' -o yaml | kubectl apply -f - | |
kubectl create secret generic mail-orders-to --save-config --dry-run=client --from-literal='key=${{ secrets.MAIL_ORDERS_TO }}' -o yaml | kubectl apply -f - | |
kubectl rollout restart deployment christelmusic-nl | |
kubectl rollout restart deployment christelmusic-nl-php |