From e1092e53c9008e7dfd64854d4862a03bd4eefe40 Mon Sep 17 00:00:00 2001 From: Sandeep Date: Tue, 19 Mar 2024 13:17:44 +0800 Subject: [PATCH 1/2] feat: :fire: setting up a test uat env --- .github/actions/publish_to_pages/action.yml | 25 ++++++++++++ .github/workflows/release_staging.yml | 3 +- .github/workflows/release_test.yml | 42 +++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/actions/publish_to_pages/action.yml create mode 100644 .github/workflows/release_test.yml diff --git a/.github/actions/publish_to_pages/action.yml b/.github/actions/publish_to_pages/action.yml new file mode 100644 index 00000000..7279fb0a --- /dev/null +++ b/.github/actions/publish_to_pages/action.yml @@ -0,0 +1,25 @@ +name: publish_to_pages +description: Publishes to cloudflare pages +inputs: + CLOUDFLARE_ACCOUNT_ID: + description: Cloudflare account id + required: true + CLOUDFLARE_API_TOKEN: + description: Cloudflare token + required: true + CF_BRANCH: + description: Cloudflare branch + required: true +runs: + using: composite + steps: + - name: Publish to cloudflare pages (staging) + env: + CLOUDFLARE_ACCOUNT_ID: ${{ inputs.CLOUDFLARE_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ inputs.CLOUDFLARE_API_TOKEN }} + run: |- + npm i wrangler@3.10.1 + cd build + npx wrangler pages deploy . --project-name=deriv-developers-portal-pages --branch=${{ inputs.CF_BRANCH }} + echo "New staging website - https://staging-api.deriv.com/" + shell: bash diff --git a/.github/workflows/release_staging.yml b/.github/workflows/release_staging.yml index 7cb3bfd0..920727be 100644 --- a/.github/workflows/release_staging.yml +++ b/.github/workflows/release_staging.yml @@ -27,10 +27,11 @@ jobs: RELEASE_TAG: ${{ github.sha }} RELEASE_TYPE: staging - name: Publish to Cloudflare Pages Staging - uses: ./.github/actions/publish_to_pages_staging + uses: ./.github/actions/publish_to_pages with: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CF_BRANCH: staging - name: Publish to Docker uses: ./.github/actions/publish_to_docker with: diff --git a/.github/workflows/release_test.yml b/.github/workflows/release_test.yml new file mode 100644 index 00000000..69896571 --- /dev/null +++ b/.github/workflows/release_test.yml @@ -0,0 +1,42 @@ +name: Deriv Api Docs Test/UAT Workflow +on: + pull_request: + branches: + - uat + workflow_dispatch: + +env: + RELEASE_TYPE: Staging +jobs: + build_and_publish: + name: Builds and Publishes to Cloudflare Pages Test + environment: Staging + runs-on: ubuntu-latest + outputs: + RELEASE_VERSION: ${{ steps.extract_version.outputs.RELEASE_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Setup Node + uses: ./.github/actions/setup_node + - name: Install dependencies + uses: ./.github/actions/npm_install_from_cache + - name: Build + uses: ./.github/actions/build + with: + NODE_ENV: staging + TRACKJS_TOKEN: ${{ secrets.TRACKJS_TOKEN }} + - name: Versioning + uses: ./.github/actions/versioning + with: + RELEASE_TAG: ${{ github.ref_name }} + RELEASE_TYPE: ${{ env.RELEASE_TYPE }} + - name: Extract version + id: extract_version + run: echo "RELEASE_VERSION=$(cat build/version.txt)" >> $GITHUB_OUTPUT + - name: Publish to Cloudflare Pages Test + uses: ./.github/actions/publish_to_pages + with: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CF_BRANCH: test From 25c59350c30320eb3f8ab2c72c6979cce27048d8 Mon Sep 17 00:00:00 2001 From: Sandeep Date: Tue, 19 Mar 2024 13:24:17 +0800 Subject: [PATCH 2/2] chore: :fire: cleanup staging workflow --- .../publish_to_pages_staging/action.yml | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 .github/actions/publish_to_pages_staging/action.yml diff --git a/.github/actions/publish_to_pages_staging/action.yml b/.github/actions/publish_to_pages_staging/action.yml deleted file mode 100644 index 63e25c8c..00000000 --- a/.github/actions/publish_to_pages_staging/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: publish_to_pages_staging -description: Publishes to cloudflare pages (staging) -inputs: - CLOUDFLARE_ACCOUNT_ID: - description: Cloudflare account id - required: true - CLOUDFLARE_API_TOKEN: - description: Cloudflare token - required: true -runs: - using: composite - steps: - - name: Publish to cloudflare pages (staging) - env: - CLOUDFLARE_ACCOUNT_ID: ${{ inputs.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_API_TOKEN: ${{ inputs.CLOUDFLARE_API_TOKEN }} - run: |- - npm i wrangler@3.10.1 - cd build - npx wrangler pages deploy . --project-name=deriv-developers-portal-pages --branch=staging - echo "New staging website - https://staging-api.deriv.com/" - shell: bash