diff --git a/.changeset/twelve-actors-flash.md b/.changeset/twelve-actors-flash.md new file mode 100644 index 00000000000..89274818fa5 --- /dev/null +++ b/.changeset/twelve-actors-flash.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Fix workflow deployments for PR automation diff --git a/.github/actions/prepare-api-variables/action.yml b/.github/actions/prepare-api-variables/action.yml index 2a52635f248..4992e260b5f 100644 --- a/.github/actions/prepare-api-variables/action.yml +++ b/.github/actions/prepare-api-variables/action.yml @@ -13,6 +13,9 @@ outputs: API_URL: description: "API url" value: ${{ steps.generate.outputs.API_URL }} + BASE_URL_DOMAIN: + description: "Dashboard domain" + value: ${{ steps.generate.outputs.BASE_URL_DOMAIN }} POOL_NAME: description: "The name of the instance" value: ${{ steps.generate.outputs.POOL_NAME }} @@ -37,6 +40,7 @@ runs: if [[ "$MODE" == 'pull-request' ]]; then echo "BASE_URL=https://${PREFIX}${PULL_REQUEST_NUMBER}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT echo "API_URL=https://${PREFIX}${PULL_REQUEST_NUMBER}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT + echo "BASE_URL_DOMAIN=${PREFIX}${PULL_REQUEST_NUMBER}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT echo "POOL_NAME=${PREFIX}${PULL_REQUEST_NUMBER}" >> $GITHUB_OUTPUT echo "POOL_INSTANCE=https://${PREFIX}${PULL_REQUEST_NUMBER}.staging.saleor.cloud" >> $GITHUB_OUTPUT echo "BACKUP_NAMESPACE=snapshot-automation-tests" >> $GITHUB_OUTPUT @@ -49,6 +53,7 @@ runs: echo "BASE_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/dashboard/" >> $GITHUB_OUTPUT echo "API_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT + echo "BASE_URL_DOMAIN=v${VERSION_SLUG}.staging.saleor.cloud" >> $GITHUB_OUTPUT echo "POOL_NAME=${GITHUB_REF_SLUG} Staging" >> $GITHUB_OUTPUT echo "POOL_INSTANCE=https://v${VERSION_SLUG}.staging.saleor.cloud/" >> $GITHUB_OUTPUT echo "BACKUP_NAMESPACE=snapshot-automation-tests-${GITHUB_REF_SLUG}" >> $GITHUB_OUTPUT @@ -59,6 +64,7 @@ runs: if [[ "$MODE" == 'main' ]]; then echo "BASE_URL=https://automation-dashboard.staging.saleor.cloud/dashboard/" >> $GITHUB_OUTPUT echo "API_URL=https://automation-dashboard.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT + echo "BASE_URL_DOMAIN=automation-dashboard.staging.saleor.cloud" >> $GITHUB_OUTPUT echo "POOL_NAME=automation-dashboard" >> $GITHUB_OUTPUT echo "POOL_INSTANCE=https://automation-dashboard.staging.saleor.cloud" >> $GITHUB_OUTPUT echo "BACKUP_NAMESPACE=snapshot-automation-tests" >> $GITHUB_OUTPUT diff --git a/.github/actions/prepare-tests-variables/action.yml b/.github/actions/prepare-tests-variables/action.yml index dc38f8f57e7..a997a3c07ad 100644 --- a/.github/actions/prepare-tests-variables/action.yml +++ b/.github/actions/prepare-tests-variables/action.yml @@ -11,6 +11,9 @@ outputs: BASE_URL: description: "Dashboard base url" value: ${{ steps.api.outputs.BASE_URL }} + BASE_URL_DOMAIN: + description: "Dashboard domain" + value: ${{ steps.api.outputs.BASE_URL_DOMAIN }} API_URL: description: "API url" value: ${{ steps.api.outputs.API_URL }} diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index 0ef212503c1..87cd9fa05e7 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -13,6 +13,7 @@ jobs: POOL_NAME: ${{ steps.cloud_variables.outputs.POOL_NAME }} POOL_INSTANCE: ${{ steps.cloud_variables.outputs.POOL_INSTANCE }} BASE_URL: ${{ steps.cloud_variables.outputs.BASE_URL }} + BASE_URL_DOMAIN: ${{ steps.cloud_variables.outputs.BASE_URL_DOMAIN }} API_URL: ${{ steps.cloud_variables.outputs.API_URL }} BACKUP_ID: ${{ steps.cloud_variables.outputs.BACKUP_ID }} BACKUP_VER: ${{ steps.cloud_variables.outputs.BACKUP_VER }} @@ -97,14 +98,14 @@ jobs: - name: Deploy to S3 env: AWS_TEST_DEPLOYMENT_BUCKET: ${{ secrets.AWS_TEST_DEPLOYMENT_BUCKET }} - BASE_URL: ${{ needs.initialize-cloud.outputs.BASE_URL }} - run: aws s3 sync ./build/dashboard "s3://${AWS_TEST_DEPLOYMENT_BUCKET}/${BASE_URL}" + BASE_URL_DOMAIN: ${{ needs.initialize-cloud.outputs.BASE_URL_DOMAIN }} + run: aws s3 sync ./build/dashboard "s3://${AWS_TEST_DEPLOYMENT_BUCKET}/${BASE_URL_DOMAIN}" - name: Invalidate cache env: AWS_TEST_CF_DIST_ID: ${{ secrets.AWS_TEST_CF_DIST_ID }} - BASE_URL: ${{ needs.initialize-cloud.outputs.BASE_URL }} - run: aws cloudfront create-invalidation --distribution-id "$AWS_TEST_CF_DIST_ID" --paths "/${BASE_URL}/*" + BASE_URL_DOMAIN: ${{ needs.initialize-cloud.outputs.BASE_URL_DOMAIN }} + run: aws cloudfront create-invalidation --distribution-id "$AWS_TEST_CF_DIST_ID" --paths "/${BASE_URL_DOMAIN}/*" - name: Update deployment status uses: bobheadxi/deployments@88ce5600046c82542f8246ac287d0a53c461bca3 @@ -113,7 +114,7 @@ jobs: step: finish token: ${{ secrets.GITHUB_TOKEN }} status: ${{ job.status }} - env_url: https://${{ needs.initialize-cloud.outputs.BASE_URL }} + env_url: ${{ needs.initialize-cloud.outputs.BASE_URL }} deployment_id: ${{ steps.deployment.outputs.deployment_id }} env: ${{ needs.initialize-cloud.outputs.POOL_NAME }} @@ -168,14 +169,14 @@ jobs: - name: Deploy to S3 env: AWS_TEST_DEPLOYMENT_BUCKET: ${{ secrets.AWS_TEST_DEPLOYMENT_BUCKET }} - BASE_URL: ${{ needs.initialize-cloud.outputs.BASE_URL }} - run: aws s3 sync ./build/storybook "s3://${AWS_TEST_DEPLOYMENT_BUCKET}/${BASE_URL}/storybook" + BASE_URL_DOMAIN: ${{ needs.initialize-cloud.outputs.BASE_URL_DOMAIN }} + run: aws s3 sync ./build/storybook "s3://${AWS_TEST_DEPLOYMENT_BUCKET}/${BASE_URL_DOMAIN}/storybook" - name: Invalidate cache env: AWS_TEST_CF_DIST_ID: ${{ secrets.AWS_TEST_CF_DIST_ID }} - BASE_URL: ${{ needs.initialize-cloud.outputs.BASE_URL }} - run: aws cloudfront create-invalidation --distribution-id "$AWS_TEST_CF_DIST_ID" --paths "/${BASE_URL}/*" + BASE_URL_DOMAIN: ${{ needs.initialize-cloud.outputs.BASE_URL_DOMAIN }} + run: aws cloudfront create-invalidation --distribution-id "$AWS_TEST_CF_DIST_ID" --paths "/${BASE_URL_DOMAIN}/*" - name: Update storybook deployment status uses: bobheadxi/deployments@88ce5600046c82542f8246ac287d0a53c461bca3 @@ -184,7 +185,7 @@ jobs: step: finish token: ${{ secrets.GITHUB_TOKEN }} status: ${{ job.status }} - env_url: https://${{ needs.initialize-cloud.outputs.BASE_URL }}/storybook/index.html + env_url: ${{ needs.initialize-cloud.outputs.BASE_URL }}/storybook/index.html deployment_id: ${{ steps.storybook-deployment.outputs.deployment_id }} env: storybook ${{ needs.initialize-cloud.outputs.POOL_NAME }}