Merge pull request #7 from leibniz-psychology/staging #19
This file contains hidden or 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: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| name: Deploy to AKS | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| GH_BRANCH: ${{ github.ref_name }} | |
| GH_SHA: ${{ github.sha }} | |
| NAMESPACE: main | |
| APP: ocpu | |
| REGISTRY: ${{ secrets.ACR_NAME }}.azurecr.io | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v2 | |
| with: | |
| ref: 'main' | |
| - 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 main and push to a Azure Container Registry (ACR) | |
| if: github.ref_name == 'main' && 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/main/opencpu/Dockerfile | |
| docker push ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }} | |
| - name: get latest tags | |
| uses: actions-ecosystem/action-get-latest-tag@v1 | |
| id: get-latest-tag | |
| with: | |
| current_version: ${{ steps.get-latest-tag.outputs.tag }} | |
| - name: set tag version tag from github | |
| run: | | |
| docker pull ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }} | |
| echo tag with ${{ steps.get-latest-tag.outputs.tag }} | |
| docker tag ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }} ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ steps.get-latest-tag.outputs.tag }} | |
| docker push ${{ secrets.ACR_NAME }}.azurecr.io/ocpu/${{ env.APP }}:${{ steps.get-latest-tag.outputs.tag }} | |
| 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 prod | |
| kustomize edit set image crzpiddev.azurecr.io/ocpu/${{ env.APP }}:${{ github.sha }} | |
| cat kustomization.yaml | |
| - name: Commit files | |
| run: | | |
| git config --local user.email "action@github.com" | |
| 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 |