Manual production deploy #101
This file contains 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: Manual production deploy | |
on: | |
workflow_dispatch: | |
jobs: | |
front-prod-deploy: | |
name: prod-deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
- name: Extract branch name | |
shell: bash | |
run: echo "name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
id: extract_branch | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN_PROD }} | |
- name: Save DigitalOcean kubeconfig with short-lived credentials | |
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.K8S_PROD }} | |
- name: Update deploy file | |
run: TAG=${{ env.name }}-$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|dappforce/subid-frontend:'${TAG}'|' $GITHUB_WORKSPACE/deployment/production/deploy.yaml | |
- name: Remove hpa | |
run: kubectl -n sub-id delete hpa subid-front | |
- name: Deploy to DigitalOcean Kubernetes | |
run: kubectl apply -f $GITHUB_WORKSPACE/deployment/production/deploy.yaml | |
- name: Verify deployment | |
run: kubectl -n sub-id rollout status deployment/subid-front | |
- name: Recreate hpa | |
run: kubectl -n sub-id create -f $GITHUB_WORKSPACE/deployment/hpa/hpa.yaml |