Skip to content

chore: fix env on ci workflow #13

chore: fix env on ci workflow

chore: fix env on ci workflow #13

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
- '!main'
jobs:
ci:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: Install dependencies
run: yarn install
- name: Extract Branch Name
id: extract-branch
run: |
echo BRANCH_NAME=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | perl -pe 's/\W/-/g and s/-+$//g') >> $GITHUB_OUTPUT
- name: Check If DNS Record Exists
id: cloudflare-dns-check
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/dns_records?name=${{steps.extract-branch.outputs.BRANCH_NAME}}.cfi-fingerprint.com'
method: 'GET'
customHeaders: '{"X-Auth-Email": "${{ secrets.CF_AUTH_EMAIL }}", "Authorization": "Bearer ${{ secrets.CF_AUTH_TOKEN }}"}'
- name: Create Cloudflare DNS Record
if: ${{ fromJson(steps.cloudflare-dns-check.outputs.response).result_info.total_count < 1 }}
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/dns_records'
method: 'POST'
customHeaders: '{"X-Auth-Email": "${{ secrets.CF_AUTH_EMAIL }}", "Authorization": "Bearer ${{ secrets.CF_AUTH_TOKEN }}"}'
data: '{"content": "${{steps.extract-branch.outputs.BRANCH_NAME}}.cfi-fingerprint.com.edgesuite.net", "name": "${{steps.extract-branch.outputs.BRANCH_NAME}}.cfi-fingerprint.com", "proxied": false, "type": "CNAME", "comment": "Akamai CI run for ${{steps.extract-branch.outputs.BRANCH_NAME}}", "ttl": 3600, "tags": ["owner:akamai-integration-ci"]}'
- name: Create .edgerc file
run: |
echo "[papi]\nclient_secret = ${{ secrets.AK_CLIENT_SECRET }}\nhost = ${{ secrets.AK_HOST }}\naccess_token = ${{ secrets.AK_ACCESS_TOKEN }}\nclient_token = ${{ secrets.AK_CLIENT_TOKEN }}" >> ~/.edgerc
- name: Check Akamai Property can be created
id: check-akamai-property
continue-on-error: true
run: AK_CONTRACT_ID=${{secrets.AK_CONTRACT_ID}} AK_GROUP_ID=${{secrets.AK_GROUP_ID}} BRANCH_NAME=${{steps.extract-branch.outputs.BRANCH_NAME}} yarn ts-node scripts/checkPropertyCanBeCreated.ts
- name: Create Akamai Property
if: steps.check-akamai-property.outcome == 'success'
id: create-akamai-property
run: AK_CONTRACT_ID=${{secrets.AK_CONTRACT_ID}} AK_GROUP_ID=${{secrets.AK_GROUP_ID}} BRANCH_NAME=${{steps.extract-branch.outputs.BRANCH_NAME}} yarn ts-node scripts/createProperty.ts