Skip to content

Merge branch 'development' into staging #9

Merge branch 'development' into staging

Merge branch 'development' into staging #9

on:
workflow_dispatch:
push:
branches: [ staging ]
jobs:
build:
name: Deploy to AKS
runs-on: ubuntu-latest
permissions:
contents: read
env:
GH_BRANCH: ${{ github.ref_name }}
GH_SHA: ${{ github.sha }}
NAMESPACE: staging
APP: ocpu
REGISTRY: ${{ secrets.ACR_NAME }}.azurecr.io
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
ref: 'staging'
- name: Azure Login
uses: azure/login@v1
with:
creds: "${{ secrets.AZURE_CREDENTIALS }}"
- name: Connect to Azure Container Registry (ACR)
run: |
az acr login --name ${{ secrets.ACR_NAME }}
- name: Create php image build based on staging and push to a Azure Container Registry (ACR)
if: github.ref_name == 'staging' && success()
run: |
DOCKER_BUILDKIT=1 docker build . -t ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }} \
--build-arg OCPU_PASS=${{ secrets.OCPU_PASS}} \
--build-arg SSL_KEY=${{ secrets.SSL_KEY}} \
--file .github/workflows/manifests/staging/opencpu/Dockerfile
docker push ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }}
- name: set tag latest-stg
run: |
docker pull ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }}
docker tag ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }} ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:latest-stg
docker push ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:latest-stg
kustomize:
name: kustomize
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
env:
APP: ocpu
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
repository: leibniz-psychology/k8s-argocd-OpenCpu-config
ref: main
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
persist-credentials: true
# path: config
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.6.1"
- name: Switch out image tag
run: |
cd stg
kustomize edit set image crzpiddev.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }}
cat kustomization.yaml
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Update docker tag "${{ github.sha }}""
- name: Git push
uses: ad-m/github-push-action@master
with:
repository: leibniz-psychology/k8s-argocd-OpenCpu-config
ssh: true
branch: main