diff --git a/.github/workflows/build-auto-generated-files.yml b/.github/workflows/build-auto-generated-files.yml new file mode 100644 index 0000000..3ee6368 --- /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 index 4e00c62..8181bc6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,37 +1,35 @@ --- -name: Deployment +name: Production Deployment on: + push: + branches: + - main workflow_dispatch: inputs: env: - description: "Deploy to (dev|prod|dev prod)" - required: true - default: "dev" - clean: - description: "Clean cache" + description: "Select environment to deploy to" + type: choice required: true - type: boolean - default: false - excludeSubfolder: - description: "Exclude a subfolder from deletion" + 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: "" - index-mode: - description: 'Type of indexing. "index" to push to Algolia, "console" for dry run.' - required: true - default: "index" - type: choice - options: - - console - - index + deployAll: + description: "Force deploy all files" + type: boolean + default: false jobs: deployment: name: Deployment - uses: AdobeDocs/adp-devsite-workflow/.github/workflows/gatsby-deploy.yml@main + 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 }} - clean: ${{ inputs.clean }} - excludeSubfolder: ${{ inputs.excludeSubfolder }} - index-mode: ${{ inputs.index-mode }} - NODE_OPTIONS: "--max-old-space-size=8192" \ No newline at end of file + 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 0000000..8c66a80 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,45 @@ +--- +name: Lint +on: + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Check for src/pages changes + id: changes + run: | + git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q '^src/pages/' \ + && echo "changed=true" >> $GITHUB_OUTPUT \ + || echo "changed=false" >> $GITHUB_OUTPUT + + - name: Lint + id: lint + if: steps.changes.outputs.changed == 'true' + 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 + if-no-files-found: ignore + + - name: Fail if linter found errors + if: steps.changes.outputs.changed == 'true' && 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 0000000..d2c75fd --- /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 new file mode 100644 index 0000000..d108f50 --- /dev/null +++ b/.github/workflows/stage.yml @@ -0,0 +1,23 @@ +--- +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 7b703cd..4ee2f6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,46 +1,16 @@ -# OS and IDE generated files # -############################## +# OS .DS_Store -.vscode -.history -.idea -.editorconfig - -# npm yarn -node_modules -package.lock -yarn-error.log -.pnp.* -.yarn/* -# keep in repo -!.gitignore -!.yarn.lock -!.yarnrc.yml -!.yarn/patches -!.yarn/plugins -!.yarn/releases -!.yarn/sdks -!.yarn/versions +# IDE +.vscode -# gatsby files +# environment variables .env -.cache -public -# cypress -cypress/videos -cypress/screenshots - -# lerna -lerna-debug.log - -# local actions -.actrc -.secrets -local-test.yml +# npm +node_modules +package-lock.json -# yalc -.yalc -yalc.lock \ No newline at end of file +# generated by .github/workflows/lint.yml +linter-report.txt diff --git a/package.json b/package.json index cfc2f0d..09f8ad8 100644 --- a/package.json +++ b/package.json @@ -1,46 +1,32 @@ { - "private": true, - "name": "adobe-io-runtime", + "name": "dev-docs-template", "version": "1.0.0", "license": "Apache-2.0", "repository": { "type": "git", - "url": "https://github.com/AdobeDocs/adobe-io-runtime" + "url": "https://github.com/AdobeDocs/dev-docs-template" }, "author": { - "name": "Stephan Ringel", - "url": "https://github.com/icaraps" + "name": "Tim Kim", + "url": "https://github.com/timkim" }, - "dependencies": { - "@adobe/gatsby-theme-aio": "^4.14.17", - "gatsby": "4.22.0", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "resolutions": { - "sharp": "0.33.0", - "gatsby-sharp": "1.12.0" + "engines": { + "node": "^24.11.0" }, "scripts": { - "start": "gatsby build && gatsby serve", - "start:prefix": "gatsby build --prefix-paths && gatsby serve --prefix-paths", - "dev": "gatsby develop", - "dev:https": "gatsby develop --https --host localhost.corp.adobe.com --port 9000", - "build": "gatsby build", - "build:incremental": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages", - "serve": "gatsby serve", - "clean": "gatsby clean", - "test:links": "remark src/pages --quiet --frail", - "lint": "docker run --rm -e RUN_LOCAL=true --env-file '.github/super-linter.env' -v \"$PWD\":/tmp/lint github/super-linter:slim-v4.10.1" - }, - "remarkConfig": { - "plugins": [ - "remark-validate-links" - ] - }, - "packageManager": "yarn@3.2.2", - "devDependencies": { - "remark-cli": "^11.0.0", - "remark-validate-links": "^12.1.0" + "dev": "npx --yes --prefer-online github:AdobeDocs/adp-devsite-utils dev", + "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" } }