Skip to content

Tweak Unit and set cache strategy to local #18

Tweak Unit and set cache strategy to local

Tweak Unit and set cache strategy to local #18

name: Test, Docker Build and Push
on:
push:
tags:
- "*"
jobs:
docker-build-and-push:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Actions Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
tags: |
islamicnetwork/api.alquran.cloud:latest
islamicnetwork/api.alquran.cloud:${{ github.ref_name }}
ghcr.io/islamic-network/api.alquran.cloud:latest
ghcr.io/islamic-network/api.alquran.cloud:${{ github.ref_name }}
deploy-london:
needs: docker-build-and-push
runs-on: ubuntu-latest
container:
image: meezaan/kubectl:latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Update Consumer and Keys
run: |
export K8S_URL=${{ secrets.K8S_LONDON_URL }}
export K8S_TOKEN=${{ secrets.K8S_LONDON_TOKEN }}
export K8S_CA=${{ secrets.K8S_LONDON_CA }}
echo "$K8S_CA" | base64 --decode > cert.crt
export REF_NAME=${{ github.ref_name }}
COMMIT_TAG=$REF_NAME
export COMMIT_TAG=$REF_NAME
envsubst <./.k8s/manifest.yml >./.k8s/manifest.yml.out
mv ./.k8s/manifest.yml.out ./.k8s/manifest.yml
kubectl apply -f .k8s/manifest.yml --kubeconfig=/dev/null --server=$K8S_URL --certificate-authority=cert.crt --token=$K8S_TOKEN
deploy-mumbai:
needs: docker-build-and-push
runs-on: ubuntu-latest
container:
image: meezaan/kubectl:latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Update Consumer and Keys
run: |
export K8S_URL=${{ secrets.K8S_MUMBAI_URL }}
export K8S_TOKEN=${{ secrets.K8S_MUMBAI_TOKEN }}
export K8S_CA=${{ secrets.K8S_MUMBAI_CA }}
echo "$K8S_CA" | base64 --decode > cert.crt
export REF_NAME=${{ github.ref_name }}
COMMIT_TAG=$REF_NAME
export COMMIT_TAG=$REF_NAME
envsubst <./.k8s/manifest.yml >./.k8s/manifest.yml.out
mv ./.k8s/manifest.yml.out ./.k8s/manifest.yml
kubectl apply -f .k8s/manifest.yml --kubeconfig=/dev/null --server=$K8S_URL --certificate-authority=cert.crt --token=$K8S_TOKEN