From 8a8ef465b98224d9a4bfe1b321fdbc3cf4e64c85 Mon Sep 17 00:00:00 2001 From: Ben Siggery Date: Thu, 6 Mar 2025 13:29:29 +0000 Subject: [PATCH 1/3] test upload --- .changeset/stupid-bottles-do.md | 5 + .github/workflows/changeset-release.yml | 384 ++++++------ .github/workflows/ci.yml | 572 +++++++++--------- .../pie-cookie-banner-cdn-publish.yml | 44 -- 4 files changed, 493 insertions(+), 512 deletions(-) create mode 100644 .changeset/stupid-bottles-do.md delete mode 100644 .github/workflows/pie-cookie-banner-cdn-publish.yml diff --git a/.changeset/stupid-bottles-do.md b/.changeset/stupid-bottles-do.md new file mode 100644 index 0000000000..36993dea9e --- /dev/null +++ b/.changeset/stupid-bottles-do.md @@ -0,0 +1,5 @@ +--- +"pie-monorepo": patch +--- + +[Fixed] - CDN publish logic v2 diff --git a/.github/workflows/changeset-release.yml b/.github/workflows/changeset-release.yml index b1236fdf04..c0fe0a29b9 100644 --- a/.github/workflows/changeset-release.yml +++ b/.github/workflows/changeset-release.yml @@ -21,201 +21,221 @@ env: GITHUB_TOKEN: ${{ secrets.CHANGESETS_TOKEN }} jobs: - changesets: - outputs: - published: ${{ steps.changesets-main.outputs.published }} - publishedPackages: ${{ steps.changesets-main.outputs.publishedPackages }} - runs-on: ${{ inputs.os }} - if: github.repository == 'justeattakeaway/pie' && ${{ github.event_name != 'pull_request' }} && - (contains(github.ref_name, 'main') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'feature')) - steps: - # Checkout the Repo - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - persist-credentials: false - # Setup Repo - - name: Setup Repo - uses: ./.github/actions/setup-repo - with: - node-version: ${{ inputs.node-version }} - os: ${{ inputs.os }} - - name: Append NPM token to .npmrc - run: | - cat << EOF > "$HOME/.npmrc" - //registry.npmjs.org/:_authToken=$NPM_TOKEN - EOF - # Build Packages - - name: Build - if: ${{ github.event_name != 'pull_request' }} && - (contains(github.ref_name, 'main') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'feature')) - uses: ./.github/actions/run-script - with: - script-name: "build" - - name: Check for pre.json file existence - id: check_files - uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 - with: - files: ".changeset/pre.json" - - name: exit prerelease mode - # If .changeset/pre.json does not exist and we did not recently exit - # prerelease mode. - if: steps.check_files.outputs.files_exists == 'true' && contains(github.ref_name, 'main') - run: npx changeset pre exit - - name: Create latest release PR - id: changesets-main - if: contains(github.ref_name, 'main') - uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 - with: - version: yarn changeset:version - publish: yarn changeset:publish - commit: "release: release packages with 'latest' tag" - # If .changeset/pre.json does not exist and we did not recently exit - # prerelease mode, enter prerelease mode with tag beta - - name: Enter beta prerelease mode - id: changesets-beta - if: steps.check_files.outputs.files_exists == 'false' && contains(github.ref_name, 'beta') - # If .changeset/pre.json does not exist and we did not recently exit - # prerelease mode, enter prerelease mode with tag beta - run: npx changeset pre enter beta - - name: Create beta release PR - if: contains(github.ref_name, 'beta') - uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 - with: - version: yarn changeset:version - publish: yarn changeset:publish - commit: "release: release packages with 'beta' tag" - - name: Enter feature prerelease mode - id: changesets-feature - if: steps.check_files.outputs.files_exists == 'false' && contains(github.ref_name, 'feature') - # If .changeset/pre.json does not exist and we did not recently exit - # prerelease mode, enter prerelease mode with tag next - run: npx changeset pre enter next - - name: Create feature release PR - if: contains(github.ref_name, 'feature') - uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 - with: - version: yarn changeset:version - publish: yarn changeset:publish - commit: "release: release packages with 'next' tag" + # changesets: + # outputs: + # published: ${{ steps.changesets-main.outputs.published }} + # publishedPackages: ${{ steps.changesets-main.outputs.publishedPackages }} + # runs-on: ${{ inputs.os }} + # if: github.repository == 'justeattakeaway/pie' && ${{ github.event_name != 'pull_request' }} && + # (contains(github.ref_name, 'main') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'feature')) + # steps: + # # Checkout the Repo + # - name: Checkout + # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # with: + # fetch-depth: 0 + # persist-credentials: false + # # Setup Repo + # - name: Setup Repo + # uses: ./.github/actions/setup-repo + # with: + # node-version: ${{ inputs.node-version }} + # os: ${{ inputs.os }} + # - name: Append NPM token to .npmrc + # run: | + # cat << EOF > "$HOME/.npmrc" + # //registry.npmjs.org/:_authToken=$NPM_TOKEN + # EOF + # # Build Packages + # - name: Build + # if: ${{ github.event_name != 'pull_request' }} && + # (contains(github.ref_name, 'main') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'feature')) + # uses: ./.github/actions/run-script + # with: + # script-name: "build" + # - name: Check for pre.json file existence + # id: check_files + # uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 + # with: + # files: ".changeset/pre.json" + # - name: exit prerelease mode + # # If .changeset/pre.json does not exist and we did not recently exit + # # prerelease mode. + # if: steps.check_files.outputs.files_exists == 'true' && contains(github.ref_name, 'main') + # run: npx changeset pre exit + # - name: Create latest release PR + # id: changesets-main + # if: contains(github.ref_name, 'main') + # uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 + # with: + # version: yarn changeset:version + # publish: yarn changeset:publish + # commit: "release: release packages with 'latest' tag" + # # If .changeset/pre.json does not exist and we did not recently exit + # # prerelease mode, enter prerelease mode with tag beta + # - name: Enter beta prerelease mode + # id: changesets-beta + # if: steps.check_files.outputs.files_exists == 'false' && contains(github.ref_name, 'beta') + # # If .changeset/pre.json does not exist and we did not recently exit + # # prerelease mode, enter prerelease mode with tag beta + # run: npx changeset pre enter beta + # - name: Create beta release PR + # if: contains(github.ref_name, 'beta') + # uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 + # with: + # version: yarn changeset:version + # publish: yarn changeset:publish + # commit: "release: release packages with 'beta' tag" + # - name: Enter feature prerelease mode + # id: changesets-feature + # if: steps.check_files.outputs.files_exists == 'false' && contains(github.ref_name, 'feature') + # # If .changeset/pre.json does not exist and we did not recently exit + # # prerelease mode, enter prerelease mode with tag next + # run: npx changeset pre enter next + # - name: Create feature release PR + # if: contains(github.ref_name, 'feature') + # uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 + # with: + # version: yarn changeset:version + # publish: yarn changeset:publish + # commit: "release: release packages with 'next' tag" - # This script performs the following logic: - # 1. Defines a list of packages with their versions. - # 2. Separates the 'pie-docs' and 'pie-storybook' packages, which have a higher priority, into a distinct list called `PRIORITIZED_PACKAGES`. - # 3. Filters out and creates a separate list (`REST_PACKAGES`) excluding: - # - The aforementioned 'pie-docs' and 'pie-storybook' packages. - # - Any package whose name starts with "wc-" (Example apps). - # - The 'pie-monorepo' package. - # 4. Combines the prioritized and the rest of the packages into one list (`COMBINED_PACKAGES`). - # 5. For each package in `COMBINED_PACKAGES`, creates a Slack message block: - # - For 'pie-docs', a specific message is generated pointing to 'pie.design'. - # - For 'pie-storybook', a distinct message is generated pointing to 'webc.pie.design'. - # - For all other packages, a generic message is generated, including links to the GitHub release and npm. - - name: Generate Slack payload blocks - if: steps.changesets-main.outputs.published == 'true' - id: generate_payload - run: | - PACKAGES='${{ steps.changesets-main.outputs.publishedPackages}}' - PRIORITIZED_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select(.name == "pie-docs" or .name == "pie-storybook")]') - REST_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select((.name != "pie-docs" and .name != "pie-storybook") and (.name | startswith("wc-") | not) and .name != "pie-monorepo")]') + # # This script performs the following logic: + # # 1. Defines a list of packages with their versions. + # # 2. Separates the 'pie-docs' and 'pie-storybook' packages, which have a higher priority, into a distinct list called `PRIORITIZED_PACKAGES`. + # # 3. Filters out and creates a separate list (`REST_PACKAGES`) excluding: + # # - The aforementioned 'pie-docs' and 'pie-storybook' packages. + # # - Any package whose name starts with "wc-" (Example apps). + # # - The 'pie-monorepo' package. + # # 4. Combines the prioritized and the rest of the packages into one list (`COMBINED_PACKAGES`). + # # 5. For each package in `COMBINED_PACKAGES`, creates a Slack message block: + # # - For 'pie-docs', a specific message is generated pointing to 'pie.design'. + # # - For 'pie-storybook', a distinct message is generated pointing to 'webc.pie.design'. + # # - For all other packages, a generic message is generated, including links to the GitHub release and npm. + # - name: Generate Slack payload blocks + # if: steps.changesets-main.outputs.published == 'true' + # id: generate_payload + # run: | + # PACKAGES='${{ steps.changesets-main.outputs.publishedPackages}}' + # PRIORITIZED_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select(.name == "pie-docs" or .name == "pie-storybook")]') + # REST_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select((.name != "pie-docs" and .name != "pie-storybook") and (.name | startswith("wc-") | not) and .name != "pie-monorepo")]') - PRIORITIZED_BLOCKS=$(echo $PACKAGES | jq -c ' - map(select(.name == "pie-docs" or .name == "pie-storybook")) | + # PRIORITIZED_BLOCKS=$(echo $PACKAGES | jq -c ' + # map(select(.name == "pie-docs" or .name == "pie-storybook")) | - if length > 0 then - [{"type": "divider"}, {"type": "header", "text": {"type": "plain_text", "text": ":rocket: Deployment Summary"}}] + - (map( - if .name == "pie-docs" then - { - "type": "section", - "block_id": "sectionBlockWithButton", - "text": { - "type": "mrkdwn", - "text": "*PIE Docs*" - }, - "accessory": { - "type": "button", - "text": { - "type": "plain_text", - "text": "Visit :book:", - "emoji": true - }, - "url": "https://pie.design" - } - } - elif .name == "pie-storybook" then - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*PIE Storybook*" - }, - "accessory": { - "type": "button", - "text": { - "type": "plain_text", - "text": "Visit :pie_team_logo:", - "emoji": true - }, - "url": "https://webc.pie.design" - } - } - else - empty - end - )) - else - . - end - ') + # if length > 0 then + # [{"type": "divider"}, {"type": "header", "text": {"type": "plain_text", "text": ":rocket: Deployment Summary"}}] + + # (map( + # if .name == "pie-docs" then + # { + # "type": "section", + # "block_id": "sectionBlockWithButton", + # "text": { + # "type": "mrkdwn", + # "text": "*PIE Docs*" + # }, + # "accessory": { + # "type": "button", + # "text": { + # "type": "plain_text", + # "text": "Visit :book:", + # "emoji": true + # }, + # "url": "https://pie.design" + # } + # } + # elif .name == "pie-storybook" then + # { + # "type": "section", + # "text": { + # "type": "mrkdwn", + # "text": "*PIE Storybook*" + # }, + # "accessory": { + # "type": "button", + # "text": { + # "type": "plain_text", + # "text": "Visit :pie_team_logo:", + # "emoji": true + # }, + # "url": "https://webc.pie.design" + # } + # } + # else + # empty + # end + # )) + # else + # . + # end + # ') - REST_COMPONENT_BLOCKS=$(echo $REST_PACKAGES | jq -c ' - if length > 0 then - [{"type": "divider"}] + - [{"type": "header", "text": {"type": "plain_text", "text": ":parcel: Package Update Summary"}}] + - map( - {"type": "section", "text": {"type": "mrkdwn", "text": "- *\(.name | sub("@justeattakeaway/pie-"; "") | (.[0:1] | ascii_upcase) + .[1:])* was updated to `\(.version)` | | " }} - ) - else - [] - end - ') + # REST_COMPONENT_BLOCKS=$(echo $REST_PACKAGES | jq -c ' + # if length > 0 then + # [{"type": "divider"}] + + # [{"type": "header", "text": {"type": "plain_text", "text": ":parcel: Package Update Summary"}}] + + # map( + # {"type": "section", "text": {"type": "mrkdwn", "text": "- *\(.name | sub("@justeattakeaway/pie-"; "") | (.[0:1] | ascii_upcase) + .[1:])* was updated to `\(.version)` | | " }} + # ) + # else + # [] + # end + # ') - BLOCKS=$(echo "[${PRIORITIZED_BLOCKS},${REST_COMPONENT_BLOCKS}]" | jq -c 'add') + # BLOCKS=$(echo "[${PRIORITIZED_BLOCKS},${REST_COMPONENT_BLOCKS}]" | jq -c 'add') - echo "BLOCKS=$BLOCKS" >> $GITHUB_ENV + # echo "BLOCKS=$BLOCKS" >> $GITHUB_ENV - - name: Send a Slack notification on publish - if: steps.changesets-main.outputs.published == 'true' - uses: slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3 # v1.27.1 - with: - channel-id: ${{ secrets.RELEASE_SLACK_CHANNEL_ID }} - payload: | - { - "blocks": ${{ env.BLOCKS }}, - "unfurl_links": false, - "unfurl_media": false - } - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + # - name: Send a Slack notification on publish + # if: steps.changesets-main.outputs.published == 'true' + # uses: slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3 # v1.27.1 + # with: + # channel-id: ${{ secrets.RELEASE_SLACK_CHANNEL_ID }} + # payload: | + # { + # "blocks": ${{ env.BLOCKS }}, + # "unfurl_links": false, + # "unfurl_media": false + # } + # env: + # SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} publish-cookie-banner-cdn: - needs: changesets + # needs: changesets runs-on: ${{ inputs.os }} if: needs.changesets.outputs.published == 'true' && contains(fromJson(needs.changesets.outputs.publishedPackages).*.name, '@justeattakeaway/pie-cookie-banner') steps: - - name: Extract cookie banner version - id: extract-version - run: | - PACKAGES='${{ needs.changesets.outputs.publishedPackages}}' - COOKIE_BANNER_VERSION=$(echo $PACKAGES | jq -r '.[] | select(.name == "@justeattakeaway/pie-cookie-banner") | .version') - echo "cookie_banner_version=$COOKIE_BANNER_VERSION" >> $GITHUB_OUTPUT - - name: Publish Cookie Banner CDN - uses: ./.github/workflows/pie-cookie-banner-cdn-publish.yml + # Checkout the Repo + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + # Setup Repo + - name: Setup Repo + uses: ./.github/actions/setup-repo with: - os: ${{ inputs.os }} node-version: ${{ inputs.node-version }} - package-version: v${{ steps.extract-version.outputs.cookie_banner_version }} + os: ${{ inputs.os }} + + # Build + - name: Build Cookie Banner + uses: ./.github/actions/run-script + with: + script-name: "build --filter=pie-cookie-banner" + + # - name: Extract cookie banner version + # id: extract-version + # run: | + # PACKAGES='${{ needs.changesets.outputs.publishedPackages }}' + # cookie_banner_version=$(echo $PACKAGES | jq -r '.[] | select(.name == "@justeattakeaway/pie-cookie-banner") | .version') + # echo "COOKIE_BANNER_VERSION=$cookie_banner_version" >> $GITHUB_ENV + + - name: Upload to S3 + run: | + aws s3 sync $GITHUB_WORKSPACE/packages/components/pie-cookie-banner/cdn_dist/ s3://$PIE_CDN_BUCKET_NAME/pie-cookie-banner/v1.2.14/ --region $AWS_REGION --content-type "text/javascript" + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: eu-west-1 + PIE_CDN_BUCKET_NAME: ${{ vars.PIE_CDN_BUCKET_NAME }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 278576c9ed..b07f1009de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,311 +56,311 @@ env: PERCY_TOKEN_PIE_SELECT: ${{ secrets.PERCY_TOKEN_PIE_SELECT }} jobs: - check-change-type: - name: Get change type - runs-on: ubuntu-latest - outputs: - pie-docs-change: ${{ steps.docs-check.outputs.docs-change }} - web-components-change: ${{ steps.component-check.outputs.web-components-change }} - storybook-change: ${{ steps.storybook-check.outputs.storybook-change }} - steps: - # Checkout the Repo - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - # Setup Repo - - name: Setup Repo - uses: ./.github/actions/setup-repo - with: - node-version: 20 - os: ubuntu-latest - - name: Verify if pie-docs has changes - id: docs-check - run: | - DOCS_CHANGE=$(npx -y turbo run build --filter='pie-docs[origin/main]' --dry=json | jq '.packages | length > 0') - echo "Change Detected: $DOCS_CHANGE" - echo "docs-change=$DOCS_CHANGE" >> $GITHUB_OUTPUT - - name: Verify if web components have changes - id: component-check - run: | - COMPONENT_CHANGE=$(npx -y turbo run build --filter='{./packages/components/*}...[origin/main]' --dry=json | jq '.packages | length > 0') - echo "Change Detected: $COMPONENT_CHANGE" - echo "web-components-change=$COMPONENT_CHANGE" >> $GITHUB_OUTPUT - - name: Verify if storybook has changes - id: storybook-check - run: | - STORYBOOK_CHANGE=$(npx -y turbo run build --filter='pie-storybook[origin/main]' --dry=json | jq '.packages | length > 0') - echo "Change Detected: $STORYBOOK_CHANGE" - echo "storybook-change=$STORYBOOK_CHANGE" >> $GITHUB_OUTPUT + # check-change-type: + # name: Get change type + # runs-on: ubuntu-latest + # outputs: + # pie-docs-change: ${{ steps.docs-check.outputs.docs-change }} + # web-components-change: ${{ steps.component-check.outputs.web-components-change }} + # storybook-change: ${{ steps.storybook-check.outputs.storybook-change }} + # steps: + # # Checkout the Repo + # - name: Checkout + # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # with: + # fetch-depth: 0 + # # Setup Repo + # - name: Setup Repo + # uses: ./.github/actions/setup-repo + # with: + # node-version: 20 + # os: ubuntu-latest + # - name: Verify if pie-docs has changes + # id: docs-check + # run: | + # DOCS_CHANGE=$(npx -y turbo run build --filter='pie-docs[origin/main]' --dry=json | jq '.packages | length > 0') + # echo "Change Detected: $DOCS_CHANGE" + # echo "docs-change=$DOCS_CHANGE" >> $GITHUB_OUTPUT + # - name: Verify if web components have changes + # id: component-check + # run: | + # COMPONENT_CHANGE=$(npx -y turbo run build --filter='{./packages/components/*}...[origin/main]' --dry=json | jq '.packages | length > 0') + # echo "Change Detected: $COMPONENT_CHANGE" + # echo "web-components-change=$COMPONENT_CHANGE" >> $GITHUB_OUTPUT + # - name: Verify if storybook has changes + # id: storybook-check + # run: | + # STORYBOOK_CHANGE=$(npx -y turbo run build --filter='pie-storybook[origin/main]' --dry=json | jq '.packages | length > 0') + # echo "Change Detected: $STORYBOOK_CHANGE" + # echo "storybook-change=$STORYBOOK_CHANGE" >> $GITHUB_OUTPUT - lint-styles: - runs-on: ubuntu-latest - steps: - # Checkout the Repo - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # Setup Repo - - name: Setup Repo - uses: ./.github/actions/setup-repo - with: - node-version: 20 - os: ubuntu-latest - # Lint Styles - - name: Lint Styles - uses: ./.github/actions/run-script - with: - script-name: "lint:style" - concurrency: 10 + # lint-styles: + # runs-on: ubuntu-latest + # steps: + # # Checkout the Repo + # - name: Checkout + # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # # Setup Repo + # - name: Setup Repo + # uses: ./.github/actions/setup-repo + # with: + # node-version: 20 + # os: ubuntu-latest + # # Lint Styles + # - name: Lint Styles + # uses: ./.github/actions/run-script + # with: + # script-name: "lint:style" + # concurrency: 10 - lint-js: - runs-on: ubuntu-latest - steps: - # Checkout the Repo - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # Setup Repo - - name: Setup Repo - uses: ./.github/actions/setup-repo - with: - node-version: 20 - os: ubuntu-latest - # Lint JS - - name: Lint JavaScript - uses: ./.github/actions/run-script - with: - script-name: "lint:scripts" + # lint-js: + # runs-on: ubuntu-latest + # steps: + # # Checkout the Repo + # - name: Checkout + # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # # Setup Repo + # - name: Setup Repo + # uses: ./.github/actions/setup-repo + # with: + # node-version: 20 + # os: ubuntu-latest + # # Lint JS + # - name: Lint JavaScript + # uses: ./.github/actions/run-script + # with: + # script-name: "lint:scripts" - build-windows-node-20: - uses: ./.github/workflows/install-build.yml - with: - os: windows-latest - node-version: 20 - secrets: inherit + # build-windows-node-20: + # uses: ./.github/workflows/install-build.yml + # with: + # os: windows-latest + # node-version: 20 + # secrets: inherit - build-ubuntu-node-18: - uses: ./.github/workflows/install-build.yml - with: - os: ubuntu-latest - node-version: 18 - secrets: inherit + # build-ubuntu-node-18: + # uses: ./.github/workflows/install-build.yml + # with: + # os: ubuntu-latest + # node-version: 18 + # secrets: inherit - build-ubuntu-node-20: - uses: ./.github/workflows/install-build.yml - needs: [ 'lint-js', 'lint-styles', 'check-change-type' ] - with: - os: ubuntu-latest - node-version: 20 - analyse-component-bundles: true - secrets: inherit + # build-ubuntu-node-20: + # uses: ./.github/workflows/install-build.yml + # needs: [ 'lint-js', 'lint-styles', 'check-change-type' ] + # with: + # os: ubuntu-latest + # node-version: 20 + # analyse-component-bundles: true + # secrets: inherit - unit-tests: - needs: 'build-ubuntu-node-20' - runs-on: ubuntu-latest - steps: - # Checkout the Repo - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # Setup Repo - - name: Setup Repo - uses: ./.github/actions/setup-repo - with: - node-version: 20 - os: ubuntu-latest - # Run Unit Tests - - name: Unit Tests - uses: ./.github/actions/run-script - with: - script-name: "test:ci" + # unit-tests: + # needs: 'build-ubuntu-node-20' + # runs-on: ubuntu-latest + # steps: + # # Checkout the Repo + # - name: Checkout + # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # # Setup Repo + # - name: Setup Repo + # uses: ./.github/actions/setup-repo + # with: + # node-version: 20 + # os: ubuntu-latest + # # Run Unit Tests + # - name: Unit Tests + # uses: ./.github/actions/run-script + # with: + # script-name: "test:ci" - deploy-storybook: - needs: unit-tests - if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main' - uses: ./.github/workflows/amplify-deploy.yml - with: - os: ubuntu-latest - node-version: 20 - amplify-app-id: d17ja0ul7nrdy0 - package-name: 'pie-storybook' - package-dist-directory: ./apps/pie-storybook/dist - bucket-name-preview: 'pie-storybook-preview' - bucket-name-main: 'pie-storybook' - sub-domain-suffix: 'storybook' - secrets: inherit + # deploy-storybook: + # needs: unit-tests + # if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main' + # uses: ./.github/workflows/amplify-deploy.yml + # with: + # os: ubuntu-latest + # node-version: 20 + # amplify-app-id: d17ja0ul7nrdy0 + # package-name: 'pie-storybook' + # package-dist-directory: ./apps/pie-storybook/dist + # bucket-name-preview: 'pie-storybook-preview' + # bucket-name-main: 'pie-storybook' + # sub-domain-suffix: 'storybook' + # secrets: inherit - # Workflow task that deploys an instance of storybook used for test suites to run against - deploy-storybook-testing: - needs: unit-tests - if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main' - uses: ./.github/workflows/amplify-deploy.yml - with: - os: ubuntu-latest - node-version: 20 - amplify-app-id: d3eyargno6okyn - package-name: 'pie-storybook' - package-dist-directory: ./apps/pie-storybook/dist - bucket-name-preview: 'pie-storybook-preview' - bucket-name-main: 'pie-storybook' - destination-dir: 'testing' - build-script: 'build:testing' - sub-domain-suffix: 'storybook-testing' - secrets: inherit + # # Workflow task that deploys an instance of storybook used for test suites to run against + # deploy-storybook-testing: + # needs: unit-tests + # if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main' + # uses: ./.github/workflows/amplify-deploy.yml + # with: + # os: ubuntu-latest + # node-version: 20 + # amplify-app-id: d3eyargno6okyn + # package-name: 'pie-storybook' + # package-dist-directory: ./apps/pie-storybook/dist + # bucket-name-preview: 'pie-storybook-preview' + # bucket-name-main: 'pie-storybook' + # destination-dir: 'testing' + # build-script: 'build:testing' + # sub-domain-suffix: 'storybook-testing' + # secrets: inherit - # TODO: DSW-1151 - Move this into a reusable action so it's not duplicated - browser-tests-components: - needs: [ build-ubuntu-node-20, deploy-storybook ] - if: needs.check-change-type.outputs.web-components-change == 'true' || github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - steps: - # Checkout the Repo - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - # Setup Repo - - name: Setup Repo - uses: ./.github/actions/setup-repo - with: - node-version: 20 - os: ubuntu-latest - # Setup Playwright - - name: Setup Playwright - uses: ./.github/actions/setup-playwright - # Run System / a11y Tests - - name: Run All System / Component / a11y Tests - uses: ./.github/actions/run-script - with: - script-name: "test:browsers:ci --filter='./packages/components/*'" - - name: Upload Playwright Report - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 - if: always() - with: - name: lit-browsers-report - path: lit-browsers-report/ - retention-days: 7 - # Run Visual Tests - - name: Run All Visual Tests - uses: ./.github/actions/run-script - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - with: - script-name: "test:visual:ci --filter='{./packages/components/*}[HEAD^1]' --filter='{./packages/tools/*}[HEAD^1]'" - concurrency: 1 - - name: Run Changed Package Visual Tests - uses: ./.github/actions/run-script - if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main' - with: - script-name: "test:visual:ci --filter='{./packages/components/*}...[origin/main]' --filter='{./packages/tools/*}...[origin/main]'" - concurrency: 1 - - name: Upload Playwright Report - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 - if: always() - with: - name: lit-visual-report - path: lit-visual-report/ - retention-days: 7 - env: - STORYBOOK_AMPLIFY_ID: d17ja0ul7nrdy0 - PR_NUMBER: ${{ github.event.number }} + # # TODO: DSW-1151 - Move this into a reusable action so it's not duplicated + # browser-tests-components: + # needs: [ build-ubuntu-node-20, deploy-storybook ] + # if: needs.check-change-type.outputs.web-components-change == 'true' || github.ref == 'refs/heads/main' + # runs-on: ubuntu-latest + # steps: + # # Checkout the Repo + # - name: Checkout + # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # with: + # fetch-depth: 0 + # # Setup Repo + # - name: Setup Repo + # uses: ./.github/actions/setup-repo + # with: + # node-version: 20 + # os: ubuntu-latest + # # Setup Playwright + # - name: Setup Playwright + # uses: ./.github/actions/setup-playwright + # # Run System / a11y Tests + # - name: Run All System / Component / a11y Tests + # uses: ./.github/actions/run-script + # with: + # script-name: "test:browsers:ci --filter='./packages/components/*'" + # - name: Upload Playwright Report + # uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + # if: always() + # with: + # name: lit-browsers-report + # path: lit-browsers-report/ + # retention-days: 7 + # # Run Visual Tests + # - name: Run All Visual Tests + # uses: ./.github/actions/run-script + # if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + # with: + # script-name: "test:visual:ci --filter='{./packages/components/*}[HEAD^1]' --filter='{./packages/tools/*}[HEAD^1]'" + # concurrency: 1 + # - name: Run Changed Package Visual Tests + # uses: ./.github/actions/run-script + # if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main' + # with: + # script-name: "test:visual:ci --filter='{./packages/components/*}...[origin/main]' --filter='{./packages/tools/*}...[origin/main]'" + # concurrency: 1 + # - name: Upload Playwright Report + # uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + # if: always() + # with: + # name: lit-visual-report + # path: lit-visual-report/ + # retention-days: 7 + # env: + # STORYBOOK_AMPLIFY_ID: d17ja0ul7nrdy0 + # PR_NUMBER: ${{ github.event.number }} - deploy-docs: - needs: unit-tests - uses: ./.github/workflows/amplify-deploy.yml - if: needs.check-change-type.outputs.pie-docs-change == 'true' || github.ref == 'refs/heads/main' - with: - os: ubuntu-latest - node-version: 20 - amplify-app-id: dvskdcoepjoyf - package-name: 'pie-docs' - package-dist-directory: ./apps/pie-docs/dist - bucket-name-preview: 'pie-docs-preview' - bucket-name-main: 'pie-docs' - sub-domain-suffix: 'docs' - secrets: inherit + # deploy-docs: + # needs: unit-tests + # uses: ./.github/workflows/amplify-deploy.yml + # if: needs.check-change-type.outputs.pie-docs-change == 'true' || github.ref == 'refs/heads/main' + # with: + # os: ubuntu-latest + # node-version: 20 + # amplify-app-id: dvskdcoepjoyf + # package-name: 'pie-docs' + # package-dist-directory: ./apps/pie-docs/dist + # bucket-name-preview: 'pie-docs-preview' + # bucket-name-main: 'pie-docs' + # sub-domain-suffix: 'docs' + # secrets: inherit - browser-tests-docs: - needs: deploy-docs - runs-on: ubuntu-latest - steps: - # Checkout the Repo - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - # Setup Repo - - name: Setup Repo - uses: ./.github/actions/setup-repo - with: - node-version: 20 - os: ubuntu-latest - # Setup Playwright - - name: Setup Playwright - uses: ./.github/actions/setup-playwright - # Run System / a11y Tests - - name: Run All System / a11y Tests - uses: ./.github/actions/run-script - with: - script-name: "test:browsers:ci --filter=pie-docs" - - name: Upload Playwright Report - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 - if: always() - with: - name: browsers-report - path: browsers-report/ - retention-days: 7 - # Run Visual Tests - - name: Run All Visual Tests - uses: ./.github/actions/run-script - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - with: - script-name: "test:visual:ci --filter=pie-docs[HEAD^1]" - concurrency: 1 - - name: Run Changed Package Visual Tests - uses: ./.github/actions/run-script - if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main' - with: - script-name: "test:visual:ci --filter=pie-docs" - concurrency: 1 - - name: Upload Playwright Report - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 - if: always() - with: - name: visual-report - path: visual-report/ - retention-days: 7 - env: - DOCS_AMPLIFY_ID: dvskdcoepjoyf - PR_NUMBER: ${{ github.event.number }} + # browser-tests-docs: + # needs: deploy-docs + # runs-on: ubuntu-latest + # steps: + # # Checkout the Repo + # - name: Checkout + # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # with: + # fetch-depth: 0 + # # Setup Repo + # - name: Setup Repo + # uses: ./.github/actions/setup-repo + # with: + # node-version: 20 + # os: ubuntu-latest + # # Setup Playwright + # - name: Setup Playwright + # uses: ./.github/actions/setup-playwright + # # Run System / a11y Tests + # - name: Run All System / a11y Tests + # uses: ./.github/actions/run-script + # with: + # script-name: "test:browsers:ci --filter=pie-docs" + # - name: Upload Playwright Report + # uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + # if: always() + # with: + # name: browsers-report + # path: browsers-report/ + # retention-days: 7 + # # Run Visual Tests + # - name: Run All Visual Tests + # uses: ./.github/actions/run-script + # if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + # with: + # script-name: "test:visual:ci --filter=pie-docs[HEAD^1]" + # concurrency: 1 + # - name: Run Changed Package Visual Tests + # uses: ./.github/actions/run-script + # if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main' + # with: + # script-name: "test:visual:ci --filter=pie-docs" + # concurrency: 1 + # - name: Upload Playwright Report + # uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + # if: always() + # with: + # name: visual-report + # path: visual-report/ + # retention-days: 7 + # env: + # DOCS_AMPLIFY_ID: dvskdcoepjoyf + # PR_NUMBER: ${{ github.event.number }} release: - needs: [ 'unit-tests', 'lint-js' ] - if: github.event_name != 'pull_request' + # needs: [ 'unit-tests', 'lint-js' ] + # if: github.event_name != 'pull_request' uses: ./.github/workflows/changeset-release.yml with: os: ubuntu-latest node-version: 20 secrets: inherit - check-all-jobs: - if: always() + # check-all-jobs: + # if: always() - needs: - - lint-styles - - lint-js - - build-ubuntu-node-18 - - build-windows-node-20 - - build-ubuntu-node-20 - - unit-tests - - browser-tests-components - - deploy-docs - - deploy-storybook - - browser-tests-docs + # needs: + # - lint-styles + # - lint-js + # - build-ubuntu-node-18 + # - build-windows-node-20 + # - build-ubuntu-node-20 + # - unit-tests + # - browser-tests-components + # - deploy-docs + # - deploy-storybook + # - browser-tests-docs - runs-on: ubuntu-latest + # runs-on: ubuntu-latest - steps: - - name: Verify if the required jobs succeeded - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 - with: - # "allowed-skips" lists jobs that are optional but should not fail - allowed-skips: browser-tests-components, deploy-docs, deploy-storybook, browser-tests-docs - jobs: ${{ toJSON(needs) }} \ No newline at end of file + # steps: + # - name: Verify if the required jobs succeeded + # uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 + # with: + # # "allowed-skips" lists jobs that are optional but should not fail + # allowed-skips: browser-tests-components, deploy-docs, deploy-storybook, browser-tests-docs + # jobs: ${{ toJSON(needs) }} \ No newline at end of file diff --git a/.github/workflows/pie-cookie-banner-cdn-publish.yml b/.github/workflows/pie-cookie-banner-cdn-publish.yml deleted file mode 100644 index b568a19370..0000000000 --- a/.github/workflows/pie-cookie-banner-cdn-publish.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Publish Pie Cookie Banner to CDN - -on: - workflow_call: - inputs: - os: - required: true - type: string - node-version: - required: true - type: string - package-version: - required: true - type: string - -env: - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - -jobs: - publish-cookie-banner-cdn: - runs-on: ${{ inputs.os }} - steps: - # Checkout the Repo - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # Setup Repo - - name: Setup Repo - uses: ./.github/actions/setup-repo - with: - node-version: ${{ inputs.node-version }} - os: ${{ inputs.os }} - # Build - - name: Build Cookie Banner - uses: ./.github/actions/run-script - with: - script-name: "build --filter=pie-cookie-banner" - - - name: Upload to S3 - run: | - aws s3 sync ${{ github.workspace }}/packages/components/pie-cookie-banner/cdn_dist/ s3://${{ vars.PIE_CDN_BUCKET_NAME }}/pie-cookie-banner/${{ inputs.package-version }}/ --region ${{ env.AWS_REGION }} --content-type "text/javascript" - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: eu-west-1 From b0e82607ea45c71426301784a4a8dd0990940579 Mon Sep 17 00:00:00 2001 From: Ben Siggery Date: Thu, 6 Mar 2025 13:30:27 +0000 Subject: [PATCH 2/3] test upload --- .github/workflows/changeset-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changeset-release.yml b/.github/workflows/changeset-release.yml index c0fe0a29b9..fdb7939598 100644 --- a/.github/workflows/changeset-release.yml +++ b/.github/workflows/changeset-release.yml @@ -205,7 +205,7 @@ jobs: publish-cookie-banner-cdn: # needs: changesets runs-on: ${{ inputs.os }} - if: needs.changesets.outputs.published == 'true' && contains(fromJson(needs.changesets.outputs.publishedPackages).*.name, '@justeattakeaway/pie-cookie-banner') + # if: needs.changesets.outputs.published == 'true' && contains(fromJson(needs.changesets.outputs.publishedPackages).*.name, '@justeattakeaway/pie-cookie-banner') steps: # Checkout the Repo - name: Checkout From c8e4a0beac8f4eb2dfa42dd94f1fe281ad08f872 Mon Sep 17 00:00:00 2001 From: Ben Siggery Date: Thu, 6 Mar 2025 13:35:34 +0000 Subject: [PATCH 3/3] reintroduce logic --- .github/workflows/changeset-release.yml | 360 +++++++-------- .github/workflows/ci.yml | 572 ++++++++++++------------ 2 files changed, 466 insertions(+), 466 deletions(-) diff --git a/.github/workflows/changeset-release.yml b/.github/workflows/changeset-release.yml index fdb7939598..1c0085fb44 100644 --- a/.github/workflows/changeset-release.yml +++ b/.github/workflows/changeset-release.yml @@ -21,191 +21,191 @@ env: GITHUB_TOKEN: ${{ secrets.CHANGESETS_TOKEN }} jobs: - # changesets: - # outputs: - # published: ${{ steps.changesets-main.outputs.published }} - # publishedPackages: ${{ steps.changesets-main.outputs.publishedPackages }} - # runs-on: ${{ inputs.os }} - # if: github.repository == 'justeattakeaway/pie' && ${{ github.event_name != 'pull_request' }} && - # (contains(github.ref_name, 'main') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'feature')) - # steps: - # # Checkout the Repo - # - name: Checkout - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # with: - # fetch-depth: 0 - # persist-credentials: false - # # Setup Repo - # - name: Setup Repo - # uses: ./.github/actions/setup-repo - # with: - # node-version: ${{ inputs.node-version }} - # os: ${{ inputs.os }} - # - name: Append NPM token to .npmrc - # run: | - # cat << EOF > "$HOME/.npmrc" - # //registry.npmjs.org/:_authToken=$NPM_TOKEN - # EOF - # # Build Packages - # - name: Build - # if: ${{ github.event_name != 'pull_request' }} && - # (contains(github.ref_name, 'main') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'feature')) - # uses: ./.github/actions/run-script - # with: - # script-name: "build" - # - name: Check for pre.json file existence - # id: check_files - # uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 - # with: - # files: ".changeset/pre.json" - # - name: exit prerelease mode - # # If .changeset/pre.json does not exist and we did not recently exit - # # prerelease mode. - # if: steps.check_files.outputs.files_exists == 'true' && contains(github.ref_name, 'main') - # run: npx changeset pre exit - # - name: Create latest release PR - # id: changesets-main - # if: contains(github.ref_name, 'main') - # uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 - # with: - # version: yarn changeset:version - # publish: yarn changeset:publish - # commit: "release: release packages with 'latest' tag" - # # If .changeset/pre.json does not exist and we did not recently exit - # # prerelease mode, enter prerelease mode with tag beta - # - name: Enter beta prerelease mode - # id: changesets-beta - # if: steps.check_files.outputs.files_exists == 'false' && contains(github.ref_name, 'beta') - # # If .changeset/pre.json does not exist and we did not recently exit - # # prerelease mode, enter prerelease mode with tag beta - # run: npx changeset pre enter beta - # - name: Create beta release PR - # if: contains(github.ref_name, 'beta') - # uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 - # with: - # version: yarn changeset:version - # publish: yarn changeset:publish - # commit: "release: release packages with 'beta' tag" - # - name: Enter feature prerelease mode - # id: changesets-feature - # if: steps.check_files.outputs.files_exists == 'false' && contains(github.ref_name, 'feature') - # # If .changeset/pre.json does not exist and we did not recently exit - # # prerelease mode, enter prerelease mode with tag next - # run: npx changeset pre enter next - # - name: Create feature release PR - # if: contains(github.ref_name, 'feature') - # uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 - # with: - # version: yarn changeset:version - # publish: yarn changeset:publish - # commit: "release: release packages with 'next' tag" + changesets: + outputs: + published: ${{ steps.changesets-main.outputs.published }} + publishedPackages: ${{ steps.changesets-main.outputs.publishedPackages }} + runs-on: ${{ inputs.os }} + if: github.repository == 'justeattakeaway/pie' && ${{ github.event_name != 'pull_request' }} && + (contains(github.ref_name, 'main') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'feature')) + steps: + # Checkout the Repo + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + persist-credentials: false + # Setup Repo + - name: Setup Repo + uses: ./.github/actions/setup-repo + with: + node-version: ${{ inputs.node-version }} + os: ${{ inputs.os }} + - name: Append NPM token to .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + # Build Packages + - name: Build + if: ${{ github.event_name != 'pull_request' }} && + (contains(github.ref_name, 'main') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'feature')) + uses: ./.github/actions/run-script + with: + script-name: "build" + - name: Check for pre.json file existence + id: check_files + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 + with: + files: ".changeset/pre.json" + - name: exit prerelease mode + # If .changeset/pre.json does not exist and we did not recently exit + # prerelease mode. + if: steps.check_files.outputs.files_exists == 'true' && contains(github.ref_name, 'main') + run: npx changeset pre exit + - name: Create latest release PR + id: changesets-main + if: contains(github.ref_name, 'main') + uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 + with: + version: yarn changeset:version + publish: yarn changeset:publish + commit: "release: release packages with 'latest' tag" + # If .changeset/pre.json does not exist and we did not recently exit + # prerelease mode, enter prerelease mode with tag beta + - name: Enter beta prerelease mode + id: changesets-beta + if: steps.check_files.outputs.files_exists == 'false' && contains(github.ref_name, 'beta') + # If .changeset/pre.json does not exist and we did not recently exit + # prerelease mode, enter prerelease mode with tag beta + run: npx changeset pre enter beta + - name: Create beta release PR + if: contains(github.ref_name, 'beta') + uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 + with: + version: yarn changeset:version + publish: yarn changeset:publish + commit: "release: release packages with 'beta' tag" + - name: Enter feature prerelease mode + id: changesets-feature + if: steps.check_files.outputs.files_exists == 'false' && contains(github.ref_name, 'feature') + # If .changeset/pre.json does not exist and we did not recently exit + # prerelease mode, enter prerelease mode with tag next + run: npx changeset pre enter next + - name: Create feature release PR + if: contains(github.ref_name, 'feature') + uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9 + with: + version: yarn changeset:version + publish: yarn changeset:publish + commit: "release: release packages with 'next' tag" - # # This script performs the following logic: - # # 1. Defines a list of packages with their versions. - # # 2. Separates the 'pie-docs' and 'pie-storybook' packages, which have a higher priority, into a distinct list called `PRIORITIZED_PACKAGES`. - # # 3. Filters out and creates a separate list (`REST_PACKAGES`) excluding: - # # - The aforementioned 'pie-docs' and 'pie-storybook' packages. - # # - Any package whose name starts with "wc-" (Example apps). - # # - The 'pie-monorepo' package. - # # 4. Combines the prioritized and the rest of the packages into one list (`COMBINED_PACKAGES`). - # # 5. For each package in `COMBINED_PACKAGES`, creates a Slack message block: - # # - For 'pie-docs', a specific message is generated pointing to 'pie.design'. - # # - For 'pie-storybook', a distinct message is generated pointing to 'webc.pie.design'. - # # - For all other packages, a generic message is generated, including links to the GitHub release and npm. - # - name: Generate Slack payload blocks - # if: steps.changesets-main.outputs.published == 'true' - # id: generate_payload - # run: | - # PACKAGES='${{ steps.changesets-main.outputs.publishedPackages}}' - # PRIORITIZED_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select(.name == "pie-docs" or .name == "pie-storybook")]') - # REST_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select((.name != "pie-docs" and .name != "pie-storybook") and (.name | startswith("wc-") | not) and .name != "pie-monorepo")]') + # This script performs the following logic: + # 1. Defines a list of packages with their versions. + # 2. Separates the 'pie-docs' and 'pie-storybook' packages, which have a higher priority, into a distinct list called `PRIORITIZED_PACKAGES`. + # 3. Filters out and creates a separate list (`REST_PACKAGES`) excluding: + # - The aforementioned 'pie-docs' and 'pie-storybook' packages. + # - Any package whose name starts with "wc-" (Example apps). + # - The 'pie-monorepo' package. + # 4. Combines the prioritized and the rest of the packages into one list (`COMBINED_PACKAGES`). + # 5. For each package in `COMBINED_PACKAGES`, creates a Slack message block: + # - For 'pie-docs', a specific message is generated pointing to 'pie.design'. + # - For 'pie-storybook', a distinct message is generated pointing to 'webc.pie.design'. + # - For all other packages, a generic message is generated, including links to the GitHub release and npm. + - name: Generate Slack payload blocks + if: steps.changesets-main.outputs.published == 'true' + id: generate_payload + run: | + PACKAGES='${{ steps.changesets-main.outputs.publishedPackages}}' + PRIORITIZED_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select(.name == "pie-docs" or .name == "pie-storybook")]') + REST_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select((.name != "pie-docs" and .name != "pie-storybook") and (.name | startswith("wc-") | not) and .name != "pie-monorepo")]') - # PRIORITIZED_BLOCKS=$(echo $PACKAGES | jq -c ' - # map(select(.name == "pie-docs" or .name == "pie-storybook")) | + PRIORITIZED_BLOCKS=$(echo $PACKAGES | jq -c ' + map(select(.name == "pie-docs" or .name == "pie-storybook")) | - # if length > 0 then - # [{"type": "divider"}, {"type": "header", "text": {"type": "plain_text", "text": ":rocket: Deployment Summary"}}] + - # (map( - # if .name == "pie-docs" then - # { - # "type": "section", - # "block_id": "sectionBlockWithButton", - # "text": { - # "type": "mrkdwn", - # "text": "*PIE Docs*" - # }, - # "accessory": { - # "type": "button", - # "text": { - # "type": "plain_text", - # "text": "Visit :book:", - # "emoji": true - # }, - # "url": "https://pie.design" - # } - # } - # elif .name == "pie-storybook" then - # { - # "type": "section", - # "text": { - # "type": "mrkdwn", - # "text": "*PIE Storybook*" - # }, - # "accessory": { - # "type": "button", - # "text": { - # "type": "plain_text", - # "text": "Visit :pie_team_logo:", - # "emoji": true - # }, - # "url": "https://webc.pie.design" - # } - # } - # else - # empty - # end - # )) - # else - # . - # end - # ') + if length > 0 then + [{"type": "divider"}, {"type": "header", "text": {"type": "plain_text", "text": ":rocket: Deployment Summary"}}] + + (map( + if .name == "pie-docs" then + { + "type": "section", + "block_id": "sectionBlockWithButton", + "text": { + "type": "mrkdwn", + "text": "*PIE Docs*" + }, + "accessory": { + "type": "button", + "text": { + "type": "plain_text", + "text": "Visit :book:", + "emoji": true + }, + "url": "https://pie.design" + } + } + elif .name == "pie-storybook" then + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*PIE Storybook*" + }, + "accessory": { + "type": "button", + "text": { + "type": "plain_text", + "text": "Visit :pie_team_logo:", + "emoji": true + }, + "url": "https://webc.pie.design" + } + } + else + empty + end + )) + else + . + end + ') - # REST_COMPONENT_BLOCKS=$(echo $REST_PACKAGES | jq -c ' - # if length > 0 then - # [{"type": "divider"}] + - # [{"type": "header", "text": {"type": "plain_text", "text": ":parcel: Package Update Summary"}}] + - # map( - # {"type": "section", "text": {"type": "mrkdwn", "text": "- *\(.name | sub("@justeattakeaway/pie-"; "") | (.[0:1] | ascii_upcase) + .[1:])* was updated to `\(.version)` | | " }} - # ) - # else - # [] - # end - # ') + REST_COMPONENT_BLOCKS=$(echo $REST_PACKAGES | jq -c ' + if length > 0 then + [{"type": "divider"}] + + [{"type": "header", "text": {"type": "plain_text", "text": ":parcel: Package Update Summary"}}] + + map( + {"type": "section", "text": {"type": "mrkdwn", "text": "- *\(.name | sub("@justeattakeaway/pie-"; "") | (.[0:1] | ascii_upcase) + .[1:])* was updated to `\(.version)` | | " }} + ) + else + [] + end + ') - # BLOCKS=$(echo "[${PRIORITIZED_BLOCKS},${REST_COMPONENT_BLOCKS}]" | jq -c 'add') + BLOCKS=$(echo "[${PRIORITIZED_BLOCKS},${REST_COMPONENT_BLOCKS}]" | jq -c 'add') - # echo "BLOCKS=$BLOCKS" >> $GITHUB_ENV + echo "BLOCKS=$BLOCKS" >> $GITHUB_ENV - # - name: Send a Slack notification on publish - # if: steps.changesets-main.outputs.published == 'true' - # uses: slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3 # v1.27.1 - # with: - # channel-id: ${{ secrets.RELEASE_SLACK_CHANNEL_ID }} - # payload: | - # { - # "blocks": ${{ env.BLOCKS }}, - # "unfurl_links": false, - # "unfurl_media": false - # } - # env: - # SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Send a Slack notification on publish + if: steps.changesets-main.outputs.published == 'true' + uses: slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3 # v1.27.1 + with: + channel-id: ${{ secrets.RELEASE_SLACK_CHANNEL_ID }} + payload: | + { + "blocks": ${{ env.BLOCKS }}, + "unfurl_links": false, + "unfurl_media": false + } + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} publish-cookie-banner-cdn: - # needs: changesets + needs: changesets runs-on: ${{ inputs.os }} - # if: needs.changesets.outputs.published == 'true' && contains(fromJson(needs.changesets.outputs.publishedPackages).*.name, '@justeattakeaway/pie-cookie-banner') + if: needs.changesets.outputs.published == 'true' && contains(fromJson(needs.changesets.outputs.publishedPackages).*.name, '@justeattakeaway/pie-cookie-banner') steps: # Checkout the Repo - name: Checkout @@ -224,16 +224,16 @@ jobs: with: script-name: "build --filter=pie-cookie-banner" - # - name: Extract cookie banner version - # id: extract-version - # run: | - # PACKAGES='${{ needs.changesets.outputs.publishedPackages }}' - # cookie_banner_version=$(echo $PACKAGES | jq -r '.[] | select(.name == "@justeattakeaway/pie-cookie-banner") | .version') - # echo "COOKIE_BANNER_VERSION=$cookie_banner_version" >> $GITHUB_ENV + - name: Extract cookie banner version + id: extract-version + run: | + PACKAGES='${{ needs.changesets.outputs.publishedPackages }}' + cookie_banner_version=$(echo $PACKAGES | jq -r '.[] | select(.name == "@justeattakeaway/pie-cookie-banner") | .version') + echo "COOKIE_BANNER_VERSION=$cookie_banner_version" >> $GITHUB_ENV - name: Upload to S3 run: | - aws s3 sync $GITHUB_WORKSPACE/packages/components/pie-cookie-banner/cdn_dist/ s3://$PIE_CDN_BUCKET_NAME/pie-cookie-banner/v1.2.14/ --region $AWS_REGION --content-type "text/javascript" + aws s3 sync $GITHUB_WORKSPACE/packages/components/pie-cookie-banner/cdn_dist/ s3://$PIE_CDN_BUCKET_NAME/pie-cookie-banner/$COOKIE_BANNER_VERSION/ --region $AWS_REGION --content-type "text/javascript" env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b07f1009de..278576c9ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,311 +56,311 @@ env: PERCY_TOKEN_PIE_SELECT: ${{ secrets.PERCY_TOKEN_PIE_SELECT }} jobs: - # check-change-type: - # name: Get change type - # runs-on: ubuntu-latest - # outputs: - # pie-docs-change: ${{ steps.docs-check.outputs.docs-change }} - # web-components-change: ${{ steps.component-check.outputs.web-components-change }} - # storybook-change: ${{ steps.storybook-check.outputs.storybook-change }} - # steps: - # # Checkout the Repo - # - name: Checkout - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # with: - # fetch-depth: 0 - # # Setup Repo - # - name: Setup Repo - # uses: ./.github/actions/setup-repo - # with: - # node-version: 20 - # os: ubuntu-latest - # - name: Verify if pie-docs has changes - # id: docs-check - # run: | - # DOCS_CHANGE=$(npx -y turbo run build --filter='pie-docs[origin/main]' --dry=json | jq '.packages | length > 0') - # echo "Change Detected: $DOCS_CHANGE" - # echo "docs-change=$DOCS_CHANGE" >> $GITHUB_OUTPUT - # - name: Verify if web components have changes - # id: component-check - # run: | - # COMPONENT_CHANGE=$(npx -y turbo run build --filter='{./packages/components/*}...[origin/main]' --dry=json | jq '.packages | length > 0') - # echo "Change Detected: $COMPONENT_CHANGE" - # echo "web-components-change=$COMPONENT_CHANGE" >> $GITHUB_OUTPUT - # - name: Verify if storybook has changes - # id: storybook-check - # run: | - # STORYBOOK_CHANGE=$(npx -y turbo run build --filter='pie-storybook[origin/main]' --dry=json | jq '.packages | length > 0') - # echo "Change Detected: $STORYBOOK_CHANGE" - # echo "storybook-change=$STORYBOOK_CHANGE" >> $GITHUB_OUTPUT + check-change-type: + name: Get change type + runs-on: ubuntu-latest + outputs: + pie-docs-change: ${{ steps.docs-check.outputs.docs-change }} + web-components-change: ${{ steps.component-check.outputs.web-components-change }} + storybook-change: ${{ steps.storybook-check.outputs.storybook-change }} + steps: + # Checkout the Repo + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + # Setup Repo + - name: Setup Repo + uses: ./.github/actions/setup-repo + with: + node-version: 20 + os: ubuntu-latest + - name: Verify if pie-docs has changes + id: docs-check + run: | + DOCS_CHANGE=$(npx -y turbo run build --filter='pie-docs[origin/main]' --dry=json | jq '.packages | length > 0') + echo "Change Detected: $DOCS_CHANGE" + echo "docs-change=$DOCS_CHANGE" >> $GITHUB_OUTPUT + - name: Verify if web components have changes + id: component-check + run: | + COMPONENT_CHANGE=$(npx -y turbo run build --filter='{./packages/components/*}...[origin/main]' --dry=json | jq '.packages | length > 0') + echo "Change Detected: $COMPONENT_CHANGE" + echo "web-components-change=$COMPONENT_CHANGE" >> $GITHUB_OUTPUT + - name: Verify if storybook has changes + id: storybook-check + run: | + STORYBOOK_CHANGE=$(npx -y turbo run build --filter='pie-storybook[origin/main]' --dry=json | jq '.packages | length > 0') + echo "Change Detected: $STORYBOOK_CHANGE" + echo "storybook-change=$STORYBOOK_CHANGE" >> $GITHUB_OUTPUT - # lint-styles: - # runs-on: ubuntu-latest - # steps: - # # Checkout the Repo - # - name: Checkout - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # # Setup Repo - # - name: Setup Repo - # uses: ./.github/actions/setup-repo - # with: - # node-version: 20 - # os: ubuntu-latest - # # Lint Styles - # - name: Lint Styles - # uses: ./.github/actions/run-script - # with: - # script-name: "lint:style" - # concurrency: 10 + lint-styles: + runs-on: ubuntu-latest + steps: + # Checkout the Repo + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # Setup Repo + - name: Setup Repo + uses: ./.github/actions/setup-repo + with: + node-version: 20 + os: ubuntu-latest + # Lint Styles + - name: Lint Styles + uses: ./.github/actions/run-script + with: + script-name: "lint:style" + concurrency: 10 - # lint-js: - # runs-on: ubuntu-latest - # steps: - # # Checkout the Repo - # - name: Checkout - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # # Setup Repo - # - name: Setup Repo - # uses: ./.github/actions/setup-repo - # with: - # node-version: 20 - # os: ubuntu-latest - # # Lint JS - # - name: Lint JavaScript - # uses: ./.github/actions/run-script - # with: - # script-name: "lint:scripts" + lint-js: + runs-on: ubuntu-latest + steps: + # Checkout the Repo + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # Setup Repo + - name: Setup Repo + uses: ./.github/actions/setup-repo + with: + node-version: 20 + os: ubuntu-latest + # Lint JS + - name: Lint JavaScript + uses: ./.github/actions/run-script + with: + script-name: "lint:scripts" - # build-windows-node-20: - # uses: ./.github/workflows/install-build.yml - # with: - # os: windows-latest - # node-version: 20 - # secrets: inherit + build-windows-node-20: + uses: ./.github/workflows/install-build.yml + with: + os: windows-latest + node-version: 20 + secrets: inherit - # build-ubuntu-node-18: - # uses: ./.github/workflows/install-build.yml - # with: - # os: ubuntu-latest - # node-version: 18 - # secrets: inherit + build-ubuntu-node-18: + uses: ./.github/workflows/install-build.yml + with: + os: ubuntu-latest + node-version: 18 + secrets: inherit - # build-ubuntu-node-20: - # uses: ./.github/workflows/install-build.yml - # needs: [ 'lint-js', 'lint-styles', 'check-change-type' ] - # with: - # os: ubuntu-latest - # node-version: 20 - # analyse-component-bundles: true - # secrets: inherit + build-ubuntu-node-20: + uses: ./.github/workflows/install-build.yml + needs: [ 'lint-js', 'lint-styles', 'check-change-type' ] + with: + os: ubuntu-latest + node-version: 20 + analyse-component-bundles: true + secrets: inherit - # unit-tests: - # needs: 'build-ubuntu-node-20' - # runs-on: ubuntu-latest - # steps: - # # Checkout the Repo - # - name: Checkout - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # # Setup Repo - # - name: Setup Repo - # uses: ./.github/actions/setup-repo - # with: - # node-version: 20 - # os: ubuntu-latest - # # Run Unit Tests - # - name: Unit Tests - # uses: ./.github/actions/run-script - # with: - # script-name: "test:ci" + unit-tests: + needs: 'build-ubuntu-node-20' + runs-on: ubuntu-latest + steps: + # Checkout the Repo + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + # Setup Repo + - name: Setup Repo + uses: ./.github/actions/setup-repo + with: + node-version: 20 + os: ubuntu-latest + # Run Unit Tests + - name: Unit Tests + uses: ./.github/actions/run-script + with: + script-name: "test:ci" - # deploy-storybook: - # needs: unit-tests - # if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main' - # uses: ./.github/workflows/amplify-deploy.yml - # with: - # os: ubuntu-latest - # node-version: 20 - # amplify-app-id: d17ja0ul7nrdy0 - # package-name: 'pie-storybook' - # package-dist-directory: ./apps/pie-storybook/dist - # bucket-name-preview: 'pie-storybook-preview' - # bucket-name-main: 'pie-storybook' - # sub-domain-suffix: 'storybook' - # secrets: inherit + deploy-storybook: + needs: unit-tests + if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main' + uses: ./.github/workflows/amplify-deploy.yml + with: + os: ubuntu-latest + node-version: 20 + amplify-app-id: d17ja0ul7nrdy0 + package-name: 'pie-storybook' + package-dist-directory: ./apps/pie-storybook/dist + bucket-name-preview: 'pie-storybook-preview' + bucket-name-main: 'pie-storybook' + sub-domain-suffix: 'storybook' + secrets: inherit - # # Workflow task that deploys an instance of storybook used for test suites to run against - # deploy-storybook-testing: - # needs: unit-tests - # if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main' - # uses: ./.github/workflows/amplify-deploy.yml - # with: - # os: ubuntu-latest - # node-version: 20 - # amplify-app-id: d3eyargno6okyn - # package-name: 'pie-storybook' - # package-dist-directory: ./apps/pie-storybook/dist - # bucket-name-preview: 'pie-storybook-preview' - # bucket-name-main: 'pie-storybook' - # destination-dir: 'testing' - # build-script: 'build:testing' - # sub-domain-suffix: 'storybook-testing' - # secrets: inherit + # Workflow task that deploys an instance of storybook used for test suites to run against + deploy-storybook-testing: + needs: unit-tests + if: (needs.check-change-type.outputs.web-components-change == 'true' || needs.check-change-type.outputs.storybook-change == 'true') || github.ref == 'refs/heads/main' + uses: ./.github/workflows/amplify-deploy.yml + with: + os: ubuntu-latest + node-version: 20 + amplify-app-id: d3eyargno6okyn + package-name: 'pie-storybook' + package-dist-directory: ./apps/pie-storybook/dist + bucket-name-preview: 'pie-storybook-preview' + bucket-name-main: 'pie-storybook' + destination-dir: 'testing' + build-script: 'build:testing' + sub-domain-suffix: 'storybook-testing' + secrets: inherit - # # TODO: DSW-1151 - Move this into a reusable action so it's not duplicated - # browser-tests-components: - # needs: [ build-ubuntu-node-20, deploy-storybook ] - # if: needs.check-change-type.outputs.web-components-change == 'true' || github.ref == 'refs/heads/main' - # runs-on: ubuntu-latest - # steps: - # # Checkout the Repo - # - name: Checkout - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # with: - # fetch-depth: 0 - # # Setup Repo - # - name: Setup Repo - # uses: ./.github/actions/setup-repo - # with: - # node-version: 20 - # os: ubuntu-latest - # # Setup Playwright - # - name: Setup Playwright - # uses: ./.github/actions/setup-playwright - # # Run System / a11y Tests - # - name: Run All System / Component / a11y Tests - # uses: ./.github/actions/run-script - # with: - # script-name: "test:browsers:ci --filter='./packages/components/*'" - # - name: Upload Playwright Report - # uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 - # if: always() - # with: - # name: lit-browsers-report - # path: lit-browsers-report/ - # retention-days: 7 - # # Run Visual Tests - # - name: Run All Visual Tests - # uses: ./.github/actions/run-script - # if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - # with: - # script-name: "test:visual:ci --filter='{./packages/components/*}[HEAD^1]' --filter='{./packages/tools/*}[HEAD^1]'" - # concurrency: 1 - # - name: Run Changed Package Visual Tests - # uses: ./.github/actions/run-script - # if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main' - # with: - # script-name: "test:visual:ci --filter='{./packages/components/*}...[origin/main]' --filter='{./packages/tools/*}...[origin/main]'" - # concurrency: 1 - # - name: Upload Playwright Report - # uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 - # if: always() - # with: - # name: lit-visual-report - # path: lit-visual-report/ - # retention-days: 7 - # env: - # STORYBOOK_AMPLIFY_ID: d17ja0ul7nrdy0 - # PR_NUMBER: ${{ github.event.number }} + # TODO: DSW-1151 - Move this into a reusable action so it's not duplicated + browser-tests-components: + needs: [ build-ubuntu-node-20, deploy-storybook ] + if: needs.check-change-type.outputs.web-components-change == 'true' || github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + steps: + # Checkout the Repo + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + # Setup Repo + - name: Setup Repo + uses: ./.github/actions/setup-repo + with: + node-version: 20 + os: ubuntu-latest + # Setup Playwright + - name: Setup Playwright + uses: ./.github/actions/setup-playwright + # Run System / a11y Tests + - name: Run All System / Component / a11y Tests + uses: ./.github/actions/run-script + with: + script-name: "test:browsers:ci --filter='./packages/components/*'" + - name: Upload Playwright Report + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + if: always() + with: + name: lit-browsers-report + path: lit-browsers-report/ + retention-days: 7 + # Run Visual Tests + - name: Run All Visual Tests + uses: ./.github/actions/run-script + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + with: + script-name: "test:visual:ci --filter='{./packages/components/*}[HEAD^1]' --filter='{./packages/tools/*}[HEAD^1]'" + concurrency: 1 + - name: Run Changed Package Visual Tests + uses: ./.github/actions/run-script + if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main' + with: + script-name: "test:visual:ci --filter='{./packages/components/*}...[origin/main]' --filter='{./packages/tools/*}...[origin/main]'" + concurrency: 1 + - name: Upload Playwright Report + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + if: always() + with: + name: lit-visual-report + path: lit-visual-report/ + retention-days: 7 + env: + STORYBOOK_AMPLIFY_ID: d17ja0ul7nrdy0 + PR_NUMBER: ${{ github.event.number }} - # deploy-docs: - # needs: unit-tests - # uses: ./.github/workflows/amplify-deploy.yml - # if: needs.check-change-type.outputs.pie-docs-change == 'true' || github.ref == 'refs/heads/main' - # with: - # os: ubuntu-latest - # node-version: 20 - # amplify-app-id: dvskdcoepjoyf - # package-name: 'pie-docs' - # package-dist-directory: ./apps/pie-docs/dist - # bucket-name-preview: 'pie-docs-preview' - # bucket-name-main: 'pie-docs' - # sub-domain-suffix: 'docs' - # secrets: inherit + deploy-docs: + needs: unit-tests + uses: ./.github/workflows/amplify-deploy.yml + if: needs.check-change-type.outputs.pie-docs-change == 'true' || github.ref == 'refs/heads/main' + with: + os: ubuntu-latest + node-version: 20 + amplify-app-id: dvskdcoepjoyf + package-name: 'pie-docs' + package-dist-directory: ./apps/pie-docs/dist + bucket-name-preview: 'pie-docs-preview' + bucket-name-main: 'pie-docs' + sub-domain-suffix: 'docs' + secrets: inherit - # browser-tests-docs: - # needs: deploy-docs - # runs-on: ubuntu-latest - # steps: - # # Checkout the Repo - # - name: Checkout - # uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - # with: - # fetch-depth: 0 - # # Setup Repo - # - name: Setup Repo - # uses: ./.github/actions/setup-repo - # with: - # node-version: 20 - # os: ubuntu-latest - # # Setup Playwright - # - name: Setup Playwright - # uses: ./.github/actions/setup-playwright - # # Run System / a11y Tests - # - name: Run All System / a11y Tests - # uses: ./.github/actions/run-script - # with: - # script-name: "test:browsers:ci --filter=pie-docs" - # - name: Upload Playwright Report - # uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 - # if: always() - # with: - # name: browsers-report - # path: browsers-report/ - # retention-days: 7 - # # Run Visual Tests - # - name: Run All Visual Tests - # uses: ./.github/actions/run-script - # if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - # with: - # script-name: "test:visual:ci --filter=pie-docs[HEAD^1]" - # concurrency: 1 - # - name: Run Changed Package Visual Tests - # uses: ./.github/actions/run-script - # if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main' - # with: - # script-name: "test:visual:ci --filter=pie-docs" - # concurrency: 1 - # - name: Upload Playwright Report - # uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 - # if: always() - # with: - # name: visual-report - # path: visual-report/ - # retention-days: 7 - # env: - # DOCS_AMPLIFY_ID: dvskdcoepjoyf - # PR_NUMBER: ${{ github.event.number }} + browser-tests-docs: + needs: deploy-docs + runs-on: ubuntu-latest + steps: + # Checkout the Repo + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + # Setup Repo + - name: Setup Repo + uses: ./.github/actions/setup-repo + with: + node-version: 20 + os: ubuntu-latest + # Setup Playwright + - name: Setup Playwright + uses: ./.github/actions/setup-playwright + # Run System / a11y Tests + - name: Run All System / a11y Tests + uses: ./.github/actions/run-script + with: + script-name: "test:browsers:ci --filter=pie-docs" + - name: Upload Playwright Report + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + if: always() + with: + name: browsers-report + path: browsers-report/ + retention-days: 7 + # Run Visual Tests + - name: Run All Visual Tests + uses: ./.github/actions/run-script + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + with: + script-name: "test:visual:ci --filter=pie-docs[HEAD^1]" + concurrency: 1 + - name: Run Changed Package Visual Tests + uses: ./.github/actions/run-script + if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) && github.ref != 'refs/heads/main' + with: + script-name: "test:visual:ci --filter=pie-docs" + concurrency: 1 + - name: Upload Playwright Report + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + if: always() + with: + name: visual-report + path: visual-report/ + retention-days: 7 + env: + DOCS_AMPLIFY_ID: dvskdcoepjoyf + PR_NUMBER: ${{ github.event.number }} release: - # needs: [ 'unit-tests', 'lint-js' ] - # if: github.event_name != 'pull_request' + needs: [ 'unit-tests', 'lint-js' ] + if: github.event_name != 'pull_request' uses: ./.github/workflows/changeset-release.yml with: os: ubuntu-latest node-version: 20 secrets: inherit - # check-all-jobs: - # if: always() + check-all-jobs: + if: always() - # needs: - # - lint-styles - # - lint-js - # - build-ubuntu-node-18 - # - build-windows-node-20 - # - build-ubuntu-node-20 - # - unit-tests - # - browser-tests-components - # - deploy-docs - # - deploy-storybook - # - browser-tests-docs + needs: + - lint-styles + - lint-js + - build-ubuntu-node-18 + - build-windows-node-20 + - build-ubuntu-node-20 + - unit-tests + - browser-tests-components + - deploy-docs + - deploy-storybook + - browser-tests-docs - # runs-on: ubuntu-latest + runs-on: ubuntu-latest - # steps: - # - name: Verify if the required jobs succeeded - # uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 - # with: - # # "allowed-skips" lists jobs that are optional but should not fail - # allowed-skips: browser-tests-components, deploy-docs, deploy-storybook, browser-tests-docs - # jobs: ${{ toJSON(needs) }} \ No newline at end of file + steps: + - name: Verify if the required jobs succeeded + uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 + with: + # "allowed-skips" lists jobs that are optional but should not fail + allowed-skips: browser-tests-components, deploy-docs, deploy-storybook, browser-tests-docs + jobs: ${{ toJSON(needs) }} \ No newline at end of file