Add new hydradx logo #156
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: Delete feature | |
on: | |
pull_request: | |
types: | |
- closed | |
jobs: | |
delete: | |
if: github.event.pull_request.merged == true | |
name: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
- uses: mdecoleman/pr-branch-name@2.0.0 | |
id: vars | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract branch name | |
shell: bash | |
run: echo "name=$(echo ${{ steps.vars.outputs.branch }} | sed 's/^deploy\///')" >> $GITHUB_ENV | |
id: extract_branch | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN_STAGING }} | |
- name: remove previous feature | |
continue-on-error: true | |
run: | | |
doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.K8S_STAGING }} | |
NAME=${{ env.name }} && sed -i 's|<BRANCH>|'${NAME}'|' $GITHUB_WORKSPACE/deployment/deploy/all.yaml | |
NAME=${{ env.name }} && sed -i 's|<BRANCH>|'${NAME}'|' $GITHUB_WORKSPACE/deployment/deploy/deployment.yaml | |
kubectl delete -f $GITHUB_WORKSPACE/deployment/deploy/ | |
- name: Get CF A record ID | |
continue-on-error: true | |
shell: bash | |
run: echo "record=$(echo $(curl -X GET "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/dns_records?type=A&name=${{ env.name }}-subid.subsocial.network&content=174.138.105.155&proxied=true&page=1&per_page=100&order=type&direction=desc&match=all" -H "X-Auth-Email:${{ secrets.CF_MAIL }}" -H "Authorization:Bearer ${{ secrets.CF_TOKEN }}" -H "Content-Type:application/json" | jq . | jq -c '.result[]' | jq -r .id) )" >> $GITHUB_ENV | |
id: cf | |
- name: delete CF A record | |
continue-on-error: true | |
run: curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/dns_records/${{ env.record }}" -H "X-Auth-Email:${{ secrets.CF_MAIL }}" -H "Authorization:Bearer ${{ secrets.CF_TOKEN }}" -H "Content-Type:application/json" | |
- name: final task | |
if: always() | |
run: echo "finished successfully" |