Production Deploy #15
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
| name: Production Deploy | |
| on: | |
| workflow_dispatch: | |
| env: | |
| CLOUD_ENV: lf-oracle-production | |
| ORACLE_DOCKER_USERNAME: ${{ secrets.ORACLE_DOCKER_USERNAME }} | |
| ORACLE_DOCKER_PASSWORD: ${{ secrets.ORACLE_DOCKER_PASSWORD }} | |
| ORACLE_USER: ${{ secrets.ORACLE_USER }} | |
| ORACLE_TENANT: ${{ secrets.ORACLE_TENANT }} | |
| ORACLE_REGION: ${{ secrets.ORACLE_REGION }} | |
| ORACLE_FINGERPRINT: ${{ secrets.ORACLE_FINGERPRINT }} | |
| ORACLE_KEY: ${{ secrets.ORACLE_KEY }} | |
| ORACLE_KEY_PASSPHRASE: ${{ secrets.ORACLE_KEY_PASSPHRASE }} | |
| ORACLE_CLUSTER: ${{ secrets.ORACLE_PRODUCTION_CLUSTER }} | |
| KUBECONFIG_PATH: /home/runner/.kube/config | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install OCI | |
| run: | | |
| curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh > install.sh | |
| chmod +x install.sh | |
| ./install.sh --accept-all-defaults | |
| echo "OCI_CLI_DIR=/home/runner/bin" >> $GITHUB_ENV | |
| - name: Update PATH | |
| run: echo "${{ env.OCI_CLI_DIR }}" >> $GITHUB_PATH | |
| - name: Build docker image | |
| uses: ./.github/actions/build-docker-image | |
| id: build-docker-image | |
| - name: Configure Oracle Cloud CLI | |
| run: | | |
| mkdir -p ~/.oci | |
| echo "${{ env.ORACLE_KEY }}" | base64 --decode > ~/.oci/oci_api_key.pem | |
| chmod 600 ~/.oci/oci_api_key.pem | |
| echo "[DEFAULT]" > ~/.oci/config | |
| echo "user=${{ env.ORACLE_USER }}" >> ~/.oci/config | |
| echo "fingerprint=${{ env.ORACLE_FINGERPRINT }}" >> ~/.oci/config | |
| echo "key_file=~/.oci/oci_api_key.pem" >> ~/.oci/config | |
| echo "tenancy=${{ env.ORACLE_TENANT }}" >> ~/.oci/config | |
| echo "region=${{ env.ORACLE_REGION }}" >> ~/.oci/config | |
| echo "pass_phrase=${{ env.ORACLE_KEY_PASSPHRASE }}" >> ~/.oci/config | |
| chmod 600 ~/.oci/config | |
| - name: Verify OCI CLI Configuration | |
| run: | | |
| oci os ns get --config-file ~/.oci/config || cat ~/.oci/config | |
| - name: Get Cluster Kubeconfig | |
| run: | | |
| oci ce cluster create-kubeconfig --cluster-id ${{ env.ORACLE_CLUSTER }} --file ${{ env.KUBECONFIG_PATH }} --region ${{ env.ORACLE_REGION }} --token-version 2.0.0 --kube-endpoint PUBLIC_ENDPOINT --overwrite | |
| - name: Update Deployment Image | |
| run: | | |
| kubectl set image deployment/insights-app-dpl frontend=${{ steps.build-docker-image.outputs.image }} -n insights | |
| kubectl rollout status deployment/insights-app-dpl -n insights |