1+ name : Deploy to AKS (dev)
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches : [ staging ]
7+
8+ jobs :
9+ build :
10+ name : Deploy to AKS
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : read
14+ env :
15+ GH_BRANCH : ${{ github.ref_name }}
16+ GH_SHA : ${{ github.sha }}
17+ NAMESPACE : staging
18+ APP : fearbase/ocpu
19+ REGISTRY : ${{ secrets.ACR_NAME }}.azurecr.io
20+ steps :
21+ - name : Check out the repo
22+ uses : actions/checkout@v2
23+ with :
24+ ref : ' staging'
25+
26+ # - name: Construct image ref
27+ # run: echo "IMAGE_REF=${REGISTRY}/${GITHUB_REPOSITORY,,}/${APP}:$(cat ${APP}/VERSION)" >> $GITHUB_ENV
28+
29+ - name : Azure Login
30+ uses : azure/login@v1
31+ with :
32+ creds : " ${{ secrets.AZURE_CREDENTIALS }}"
33+
34+ - name : Connect to Azure Container Registry (ACR)
35+ run : |
36+ az acr login --name ${{ secrets.ACR_NAME }}
37+
38+ - name : Create php image build based on staging and push to a Azure Container Registry (ACR)
39+ if : github.ref_name == 'staging' && success()
40+ run : |
41+ DOCKER_BUILDKIT=1 docker build . -t ${{ secrets.ACR_NAME }}.azurecr.io/${{ env.APP }}:${{ github.sha }} \
42+ --build-arg OCPU_PASS=${{ secrets.OCPU_PASS}} \
43+ --build-arg SSL_KEY=${{ secrets.SSL_KEY}} \
44+ --file .github/workflows/manifests/staging/opencpu/Dockerfile
45+ docker push ${{ secrets.ACR_NAME }}.azurecr.io/${{ env.APP }}:${{ github.sha }}
46+
47+ - name : set tag latest-stg
48+ run : |
49+ docker pull ${{ secrets.ACR_NAME }}.azurecr.io/${{ env.APP }}:${{ github.sha }}
50+ docker tag ${{ secrets.ACR_NAME }}.azurecr.io/${{ env.APP }}:${{ github.sha }} ${{ secrets.ACR_NAME }}.azurecr.io/${{ env.APP }}:latest-stg
51+ docker push ${{ secrets.ACR_NAME }}.azurecr.io/${{ env.APP }}:latest-stg
52+ kustomize :
53+ name : kustomize
54+ runs-on : ubuntu-latest
55+ needs : build
56+ permissions :
57+ contents : read
58+ env :
59+ APP : fearbase/ocpu
60+ steps :
61+ - name : Check out the repo
62+ uses : actions/checkout@v3
63+ with :
64+ repository : leibniz-psychology/FEARBASE-R-gitops
65+ ref : main
66+ ssh-key : ${{ secrets.SSH_PRIVATE_KEY }}
67+ persist-credentials : true
68+ # path: config
69+
70+ - name : Setup Kustomize
71+ uses : imranismail/setup-kustomize@v1
72+ with :
73+ kustomize-version : " 3.6.1"
74+
75+ - name : Switch out image tag
76+ run : |
77+ cd stg
78+ kustomize edit set image crzpiddev.azurecr.io/${{ env.APP }}:${{ github.sha }}
79+ cat kustomization.yaml
80+
81+ - name : Commit files
82+ run : |
83+ git config --local user.email "action@github.com"
84+ git config --local user.name "GitHub Action"
85+ git commit -am "Update docker tag "${{ github.sha }}""
86+ - name : Git push
87+ uses : ad-m/github-push-action@master
88+ with :
89+ repository : leibniz-psychology/FEARBASE-R-gitops
90+ ssh : true
91+ branch : main
0 commit comments