diff --git a/.github/workflows/build-auto-generated-files.yml b/.github/workflows/build-auto-generated-files.yml new file mode 100644 index 000000000..3ee6368d8 --- /dev/null +++ b/.github/workflows/build-auto-generated-files.yml @@ -0,0 +1,11 @@ +--- +name: Build Auto-Generated Files +on: + workflow_dispatch: + +jobs: + build-contributors: + name: Build Auto-Generated Files + uses: AdobeDocs/adp-devsite-workflow/.github/workflows/build-auto-generated-files-v2.yml@main + secrets: inherit + \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..8181bc6b5 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,35 @@ +--- +name: Production Deployment +on: + push: + branches: + - main + workflow_dispatch: + inputs: + env: + description: "Select environment to deploy to" + type: choice + required: true + default: "prod" + options: + - "prod" + - "stage & prod" + baseSha: + description: "Use base SHA commit to deploy from (empty string defaults to last commit before HEAD)" + type: string + required: false + default: "" + deployAll: + description: "Force deploy all files" + type: boolean + default: false +jobs: + deployment: + name: Deployment + if: github.actor != 'adp-devsite-app[bot]' && github.repository != 'AdobeDocs/dev-docs-template' + uses: AdobeDocs/adp-devsite-workflow/.github/workflows/deploy-v2.yml@main + secrets: inherit + with: + env: ${{ inputs.env || 'prod' }} + baseSha: ${{ inputs.baseSha || '' }} + deployAll: ${{ inputs.deployAll || false }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..44d6c6b7e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,36 @@ +--- +name: Lint +on: + pull_request: + branches: [main] + paths: + - 'src/pages/**' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Lint + id: lint + continue-on-error: true + run: npx --yes github:AdobeDocs/adp-devsite-utils runLint -v + + - name: Save PR number + if: always() + run: echo "${{ github.event.pull_request.number }}" > pr-number.txt + + - name: Upload linter report + if: always() + uses: actions/upload-artifact@v7 + with: + name: linter-report + path: | + linter-report.txt + pr-number.txt + + - name: Fail if linter found errors + if: steps.lint.outcome == 'failure' + run: exit 1 diff --git a/.github/workflows/post-lint-comment.yml b/.github/workflows/post-lint-comment.yml new file mode 100644 index 000000000..d2c75fd10 --- /dev/null +++ b/.github/workflows/post-lint-comment.yml @@ -0,0 +1,32 @@ +--- +name: Post Linter Report +on: + workflow_run: + workflows: ["Lint"] + types: + - completed + +permissions: + pull-requests: write + +jobs: + comment: + runs-on: ubuntu-latest + if: github.event.workflow_run.event == 'pull_request' + steps: + - name: Download linter report artifact + uses: actions/download-artifact@v8 + with: + name: linter-report + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Post Linter Report to PR + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + LINTER_REPORT_PATH: ./linter-report.txt + PR_NUMBER_PATH: ./pr-number.txt + run: | + npm install --no-save github:AdobeDocs/adp-devsite-scripts + node node_modules/adp-devsite-scripts/linter-bot/postLinterReport.js diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index 2e0b0d296..d108f5015 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -1,128 +1,23 @@ --- - name: Staging deployment - on: - workflow_dispatch: - inputs: - clean: - description: 'Clean cache (yes|no)' - required: true - default: 'yes' - excludeSubfolder: - description: 'Exclude a subfolder from deletion' - required: false - default: '' - jobs: - set-state: - runs-on: ubuntu-latest - outputs: - clean_cache: ${{ contains(github.event.inputs.clean, 'yes') }} - path_prefix: ${{ steps.get_path_prefix.outputs.path_prefix }} - branch_short_ref: ${{ steps.get_branch.outputs.branch }} - exclude_subfolder: ${{ github.event.inputs.excludeSubfolder }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Get pathPrefix - uses: actions/github-script@v7 - id: get_path_prefix - with: - script: | - const script = require('./.github/scripts/get-path-prefix.js'); - script({ core }); - result-encoding: string - - name: Get branch name - shell: bash - run: echo "branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT" - id: get_branch - - echo-state: - needs: [set-state] - runs-on: ubuntu-latest - steps: - - run: echo "Clean cache - ${{ needs.set-state.outputs.clean_cache }}" - - run: echo "Repository org - ${{ github.event.repository.owner.login }}" - - run: echo "Repository name - ${{ github.event.repository.name }}" - - run: echo "Repository branch - ${{ needs.set-state.outputs.branch_short_ref }}" - - run: echo "Path prefix - ${{ needs.set-state.outputs.path_prefix }}" - - run: echo "Exclude subfolder - ${{ needs.set-state.outputs.exclude_subfolder }}" - - pre-build: - needs: [set-state] - runs-on: ubuntu-latest - steps: - - name: check dev azure connection string - if: env.AIO_AZURE_DEV_CONNECTION_STRING == null - run: | - echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_DEV_CONNECTION_STRING in Github Secrets" - exit 1 - env: - AIO_AZURE_DEV_CONNECTION_STRING: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }} - - build: - defaults: - run: - shell: bash - needs: [set-state, pre-build] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Use Setup Node and Install Dependencies Action - uses: commerce-docs/devsite-install-action@main - with: - node-version-file: '.nvmrc' - cache-dependency-path: 'yarn.lock' - - - name: Gatsby Cache - uses: actions/cache@v4 - with: - path: | - public - .cache - key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }} - restore-keys: | - ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache- - - - name: Clean Cache - if: needs.set-state.outputs.clean_cache == 'true' - run: yarn clean - - - name: Build site - run: yarn build - env: - PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build' - PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }} - GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_DEV_SRC }} - GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_DEV}} - GATSBY_ADOBE_ANALYTICS_ENV: 'dev' - REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_OWNER: ${{ github.event.repository.owner.login }} - REPO_NAME: ${{ github.event.repository.name }} - REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }} - GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} - GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} - GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }} - GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }} - GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_DEV_SRC }} - GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_DEV_CONFIG }} - GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }} - GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }} - ALGOLIA_INDEXATION_MODE: skip - GATSBY_ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }} - GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }} - GATSBY_SITE_DOMAIN_URL: https://developer-stage.adobe.com - - - name: Deploy - uses: AdobeDocs/static-website-deploy@master - with: - enabled-static-website: 'true' - source: 'public' - target: ${{ needs.set-state.outputs.path_prefix }} - connection-string: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }} - remove-existing-files: 'true' - exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }} - - name: Purge Fastly Cache - uses: AdobeDocs/gatsby-fastly-purge-action@master - with: - fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }} - fastly-url: '${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}' +name: Staging +on: + workflow_dispatch: + inputs: + baseSha: + description: "Use base SHA commit to deploy from (empty string defaults to last commit before HEAD)" + type: string + required: false + default: "" + deployAll: + description: "Force deploy all files" + type: boolean + default: false +jobs: + deployment: + name: Deployment + uses: AdobeDocs/adp-devsite-workflow/.github/workflows/deploy-v2.yml@main + secrets: inherit + with: + env: stage + baseSha: ${{ inputs.baseSha }} + deployAll: ${{ inputs.deployAll }} diff --git a/.gitignore b/.gitignore index 687cd3fa2..ee08c5795 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +# .gitignore + # OS and IDE generated files # ############################## @@ -12,7 +14,7 @@ bin/ # npm yarn node_modules -package.lock +package-lock.json yarn-error.log .pnp.* .yarn/* @@ -46,4 +48,8 @@ local-test.yml # yalc .yalc -yalc.lock \ No newline at end of file +yalc.lock + +# Added by update-bot +linter-output.txt +linter-report.txt diff --git a/package.json b/package.json index d086759a2..5dc24903b 100644 --- a/package.json +++ b/package.json @@ -13,24 +13,19 @@ "react": "^17.0.2", "react-dom": "^17.0.2" }, + "engines": { + "node": "^24.11.0" + }, "overrides": { "axios": "0.30.0" }, "resolutions": { "axios": "0.30.0" }, - "devDependencies": { - "remark-cli": "^12.0.1", - "remark-frontmatter": "^5.0.0", - "remark-heading-id": "^1.0.1", - "remark-lint-frontmatter-schema": "^3.15.4", - "remark-validate-links": "13.0.1", - "spectaql": "^3.0.6" - }, "scripts": { "start": "NODE_OPTIONS='--max-old-space-size=8192' gatsby build && gatsby serve", "start:prefix": "NODE_OPTIONS='--max-old-space-size=8192' gatsby build --prefix-paths && gatsby serve --prefix-paths", - "dev": "NODE_OPTIONS='--max-old-space-size=8192' gatsby develop", + "dev": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils dev", "dev:https": "NODE_OPTIONS='--max-old-space-size=8192' gatsby develop --https --host localhost.corp.adobe.com --port 9000", "build": "NODE_OPTIONS='--max-old-space-size=8192' gatsby build", "serve": "NODE_OPTIONS='--max-old-space-size=8192' gatsby serve", @@ -41,7 +36,19 @@ "build:spectaql:2.4.7": "spectaql --target-file index.html --config spectaql/config_2.4.7.yml", "build:spectaql:saas": "spectaql --target-file index.html --config spectaql/config_saas.yml", "build:spectaql:2.4.8": "spectaql --target-file index.html --config spectaql/config_2.4.8.yml", - "dev:spectaql": "spectaql --development-mode-live --config spectaql/config.yml" - }, - "packageManager": "yarn@3.2.4" + "dev:spectaql": "spectaql --development-mode-live --config spectaql/config.yml", + "buildNavigation": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildNavigation -v", + "buildRedirections": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildRedirections -v", + "renameFiles": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils renameFiles -v", + "normalizeLinks": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils normalizeLinks -v", + "buildSiteWideBanner": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildSiteWideBanner -v", + "buildSiteMetadata": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildSiteMetadata -v", + "buildContributors": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils buildContributorsV2 -v", + "lint": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils runLint -v", + "lint:errorOnly": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils runLint", + "link:externalLinkOnly": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils runLint --external-links-only -v", + "link:checkAllLinks": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils runLint --internal-links-only --external-links-only -v", + "redirectCheck:stage": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils redirectChecker stage --verbose", + "redirectCheck:prod": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils redirectChecker prod --verbose" + } }