Skip to content

Commit 9a085ab

Browse files
authored
Merge branch 'main' into jules-4796
2 parents 3041e35 + 856c2d7 commit 9a085ab

File tree

7,766 files changed

+526718
-1143079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,766 files changed

+526718
-1143079
lines changed

.github/actions-scripts/enterprise-server-issue-templates/deprecation-issue.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ The day after a GHES version's [deprecation date](https://github.com/github/docs
1515

1616
- [ ] In your checkout of the [repo with archived GHES content](https://github.com/github/help-docs-archived-enterprise-versions), create a new branch: `git checkout -b deprecate-<version>`
1717
- [ ] In your `docs-internal` checkout, download the static files for the oldest supported version into your archival checkout:
18+
The archive script depends on an optional dependency so install optional dependencies first:
19+
```
20+
$ npm ci --include-optional
21+
```
22+
Then run the archive script:
1823
```
1924
$ script/enterprise-server-deprecations/archive-version.js -p <path-to-archive-repo-checkout>
2025
```
@@ -26,52 +31,52 @@ The day after a GHES version's [deprecation date](https://github.com/github/docs
2631
2732
## Step 2: Upload the assets directory to Azure storage
2833
29-
- [ ] Log in to the Azure portal from Okta. Navigate to the [githubdocs Azure Storage Blob resoruce](https://portal.azure.com/#@githubazure.onmicrosoft.com/resource/subscriptions/fa6134a7-f27e-4972-8e9f-0cedffa328f1/resourceGroups/docs-production/providers/Microsoft.Storage/storageAccounts/githubdocs/overview).
34+
- [ ] Log in to the Azure portal from Okta. Navigate to the [githubdocs Azure Storage Blob resource](https://portal.azure.com/#@githubazure.onmicrosoft.com/resource/subscriptions/fa6134a7-f27e-4972-8e9f-0cedffa328f1/resourceGroups/docs-production/providers/Microsoft.Storage/storageAccounts/githubdocs/overview).
3035
- [ ] Click the "Open in Explorer" button to the right of search box.If you haven't already, click the download link to download "Microsoft Azure Storage Explorer." To login to the app, click the plug icon in the left sidebar and click the option to "add an azure account." When you login, you'll need a yubikey to authenticate through Okta.
3136
- [ ] From the Microsoft Azure Storage Explorer app, select the `githubdocs` storage account resource and navigate to the `github-images` blob container.
3237
- [ ] Click "Upload" and select "Upload folder." Click the "Selected folder" input to navigate to the `help-docs-archived-enterprise-versions` repository and select the `assets` directory for the version you just generated. In the "Destination folder" input, add the version number. For example, `/enterprise/2.22/`.
3338
- [ ] Check the log to ensure all files were uploaded successfully.
34-
- [ ] Removed the `assets` directory from the `/help-docsc-archived-enterprise-versions` repository.
39+
- [ ] Remove the `assets` directory from your `help-docsc-archived-enterprise-versions` repository, we don't want to commit that directory in the next step.
3540
3641
## Step 3: Commit and push changes to help-docs-archived-enterprise-versions repo
3742
38-
- [ ] Search for `site-search-input` in the compressed Javascript files. When you find it, use something like https://beautifier.io/ to reformat it to be readable. Find `site-search-input` in the file, there will be something like... `1125: function () { return [SearchReactComponent] },` Delete the innards of this function, but leave the `function() {}` part.
43+
- [ ] Search for `site-search-input` in the compressed Javascript files (should find the file in the `_next` directory). When you find it, use something like https://beautifier.io/ to reformat it to be readable. Find `site-search-input` in the file, the result will be enclosed in a function that looks something like... `1125: function () { ... },` Delete the innards of this function, but leave the `function() {}` part.
44+
- [ ] Copy, paste, and save the updated file back into your local `help-docs-archived-enterprise-versions` repository.
3945
- [ ] In your archival checkout, `git add <version>`, commit, and push.
4046
- [ ] Open a PR and merge it in. Note that the version will _not_ be deprecated on the docs site until you do the next step.
4147
4248
## Step 4: Deprecate the version in docs-internal
4349
4450
In your `docs-internal` checkout:
4551
- [ ] Create a new branch: `git checkout -b deprecate-<version>`.
46-
- [ ] Edit `lib/enterprise-server-releases.js` by moving the number to be deprecated into the `deprecated` array.
52+
- [ ] Edit `lib/enterprise-server-releases.js` by removing the version number to be deprecated from the `supported` array and move it to the `deprecated` array.
4753
- [ ] Open a new PR. Make sure to check the following:
48-
- [ ] Tests are passing.
49-
- [ ] The deprecated version renders on staging as expected. You should be able to navigate to docs.github.com/enterprise/<DEPRECATED VERSION> to access the docs. You should also be able to navigate to a page that is available in the deprecated version and change the version in the URL to the deprecated version, to test redirects.
54+
- [ ] Tests are passing (you may need to include the changes in step 6 to get tests to pass).
55+
- [ ] The deprecated version renders in preview as expected. You should be able to navigate to `docs.github.com/enterprise/<DEPRECATED VERSION>` to access the docs. You should also be able to navigate to a page that is available in the deprecated version and change the version in the URL to the deprecated version, to test redirects.
5056
- [ ] The new oldest supported version renders on staging as expected. You should see a banner on the top of every page for the oldest supported version that notes when the version will be deprecated.
5157
52-
You may need to include the changes in step 6 to get tests to pass.
53-
5458
## Step 5: Remove static files for the version
5559
56-
- [ ] In your `docs-internal` checkout, from your `remove-<version>-static-files` branch: `git checkout -b remove-<version>-static-files`
60+
- [ ] In your `docs-internal` checkout, create a new branch `remove-<version>-static-files` branch: `git checkout -b remove-<version>-static-files` (you can branch off of `main` or from your `deprecate-<version>` branch, up to you).
5761
- [ ] Run `script/enterprise-server-deprecations/remove-static-files.js` and commit results.
5862
- [ ] Run `script/enterprise-server-deprecations/remove-redirects.js` and commit results.
59-
- [ ] `lib/rest/static` directory has deferenced and decorated directory underneath, remove the numbered version and all below from the list
6063
- [ ] Open a new PR.
6164
- [ ] Get a review from docs-engineering and merge. This step can be merged independently from step 6. The purpose of splitting up steps 5 and 6 is to focus the review on specific files.
6265
6366
## Step 6: Remove the liquid conditionals and content for the version
6467
65-
- [ ] In your `docs-internal` checkout, from your `remove-<version>-markup` branch: `git checkout -b remove-<version>-markup`
68+
- [ ] In your `docs-internal` checkout, create a new branch `remove-<version>-markup` branch: `git checkout -b remove-<version>-markup` (you can branch off of `main` or from your `deprecate-<version>` branch, up to you).
6669
- [ ] Remove the outdated Liquid markup and frontmatter.
6770
- [ ] Run the script: `script/enterprise-server-deprecations/remove-version-markup.js --release <number>`.
6871
- [ ] Spot check a few changes. Content, frontmatter, and data files should all have been updated.
6972
- [ ] Open a PR with the results. The diff may be large and complex, so make sure to get a review from `@github/docs-content`.
70-
- [ ] Debug any test failures or unexpected results.
73+
- [ ] Debug any test failures or unexpected results -- it's very likely manual updates will be necessary, the script does a lot of work but doesn't automate everything and can't 100% replace human intent.
7174
- [ ] When the PR is approved, merge it in to complete the deprecation. This can be merged independently from step 5.
7275
7376
## Step 7: Deprecate the OpenAPI description in `github/github`
7477
7578
- [ ] In `github/github`, edit the release's config file in `app/api/description/config/releases/`, and change `deprecated: false` to `deprecated: true`.
7679
- [ ] Open a new PR, and get the required code owner approvals. A docs-content team member can approve it for the docs team.
77-
- [ ] When the PR is approved, merge the `github/github` PR.
80+
- [ ] When the PR is approved, [deploy the `github/github` PR](https://thehub.github.com/engineering/devops/deployment/deploying-dotcom/). If you haven't deployed a `github/github` PR before, work with someone that has -- the process isn't too involved depending on how you deploy, but there are a lot of details that can potentially be confusing as you can see from the documentation.
81+
82+
**Note**: you can do this step independently of the other steps after a GHES version is deprecated since it should no longer get updates in github/github. You should plan to get this PR merged as soon as possible, otherwise if you wait too long our OpenAPI automation may re-add the static files that you removed in step 5.

.github/dependabot.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,3 @@ updates:
2626
schedule:
2727
interval: weekly
2828
day: thursday
29-
ignore:
30-
- dependency-name: '*'
31-
update-types:
32-
['version-update:semver-patch', 'version-update:semver-minor']

.github/workflows/60-days-stale-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/stale@7fb802b3079a276cf3c7e6ba9aa003c665b3f838
20+
- uses: actions/stale@3cc123766321e9f15a6676375c154ccffb12a358
2121
with:
2222
repo-token: ${{ secrets.GITHUB_TOKEN }}
2323
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity.'

.github/workflows/azure-preview-env-deploy.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ permissions:
3434

3535
# This allows one deploy workflow to interrupt another
3636
concurrency:
37-
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label }}'
37+
group: 'preview-env @ ${{ github.head_ref || github.run_id }} for ${{ github.event.number || github.event.inputs.PR_NUMBER }}'
3838
cancel-in-progress: true
3939

4040
jobs:
@@ -162,6 +162,11 @@ jobs:
162162
rsync -rptovR ./user-code/content/./**/*.md ./content
163163
rsync -rptovR ./user-code/assets/./**/*.png ./assets
164164
rsync -rptovR ./user-code/data/./**/*.{yml,md} ./data
165+
rsync -rptovR ./user-code/components/./**/*.{ts,tsx} ./components
166+
rsync -rptovR --ignore-missing-args ./user-code/lib/./**/*.{js,ts} ./lib
167+
rsync -rptovR --ignore-missing-args ./user-code/middleware/./**/*.{js,ts} ./middleware
168+
rsync -rptovR ./user-code/pages/./**/*.tsx ./pages
169+
rsync -rptovR ./user-code/stylesheets/./**/*.scss ./stylesheets
165170
166171
# In addition to making the final image smaller, we also save time by not sending unnecessary files to the docker build context
167172
- name: 'Prune for preview env'

.github/workflows/azure-preview-env-destroy.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ on:
1919
permissions:
2020
contents: read
2121

22+
# This allows one deploy workflow to interrupt another
23+
concurrency:
24+
group: 'preview-env @ ${{ github.head_ref || github.run_id }} for ${{ github.event.number || github.event.inputs.PR_NUMBER }}'
25+
cancel-in-progress: true
26+
2227
jobs:
2328
destory-azure-preview-env:
2429
name: Destroy
@@ -56,7 +61,7 @@ jobs:
5661
# This will fail if the IMAGE_REPO doesn't exist, but we don't care
5762
- name: 'Untag all docker images for this PR'
5863
run: |
59-
az acr repository delete -n ${{ secrets.NONPROD_REGISTRY_NAME }} --repository ${{ env.IMAGE_REPO }} -y || true
64+
az acr repository delete -n ${{ secrets.NONPROD_REGISTRY_SERVER }} --repository ${{ env.IMAGE_REPO }} -y || true
6065
6166
# Remove all GitHub deployments from this environment and remove the environment
6267
- uses: strumwolf/delete-deployment-environment@45c821e46baa405e25410700fe2e9643929706a0
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: Azure Production - Build and Deploy
2+
3+
# **What it does**: Builds and deploys the default branch to production
4+
# **Why we have it**: To enable us to deploy the latest to production whenever necessary rather than relying on PR merges.
5+
# **Who does it impact**: All contributors.
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
deployments: write
16+
17+
# This allows a subsequently queued workflow run to take priority over
18+
# previously queued runs but NOT interrupt currently executing runs
19+
concurrency:
20+
group: '${{ github.workflow }}'
21+
cancel-in-progress: false
22+
23+
jobs:
24+
azure-prod-build-and-deploy:
25+
if: ${{ github.repository == 'github/docs-internal' }}
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 20
28+
environment:
29+
name: production
30+
url: 'https://docs.github.com'
31+
env:
32+
DOCKER_IMAGE: ${{ secrets.PROD_REGISTRY_SERVER }}/${{ github.repository }}:${{ github.sha }}
33+
DOCKER_IMAGE_CACHE_REF: ${{ secrets.PROD_REGISTRY_SERVER }}/${{ github.repository }}:main-production
34+
35+
steps:
36+
- name: 'Az CLI login'
37+
uses: azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
38+
with:
39+
creds: ${{ secrets.PROD_AZURE_CREDENTIALS }}
40+
41+
- name: 'Docker login'
42+
uses: azure/docker-login@81744f9799e7eaa418697cb168452a2882ae844a
43+
with:
44+
login-server: ${{ secrets.PROD_REGISTRY_SERVER }}
45+
username: ${{ secrets.PROD_REGISTRY_USERNAME }}
46+
password: ${{ secrets.PROD_REGISTRY_PASSWORD }}
47+
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25
50+
51+
- name: Check out repo
52+
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
53+
with:
54+
ref: ${{ github.sha }}
55+
# To prevent issues with cloning early access content later
56+
persist-credentials: 'false'
57+
lfs: 'true'
58+
59+
- name: Check out LFS objects
60+
run: git lfs checkout
61+
62+
- name: Setup node
63+
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561
64+
with:
65+
node-version: 16.14.x
66+
cache: npm
67+
68+
- name: Clone docs-early-access
69+
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
70+
with:
71+
repository: github/docs-early-access
72+
token: ${{ secrets.DOCUBOT_REPO_PAT }}
73+
path: docs-early-access
74+
ref: main
75+
76+
- name: Merge docs-early-access repo's folders
77+
run: .github/actions-scripts/merge-early-access.sh
78+
79+
- name: 'Build and push image'
80+
uses: docker/build-push-action@7f9d37fa544684fb73bfe4835ed7214c255ce02b
81+
with:
82+
context: .
83+
push: true
84+
target: production
85+
tags: ${{ env.DOCKER_IMAGE }}, ${{ env.DOCKER_IMAGE_CACHE_REF }}
86+
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE_CACHE_REF }}
87+
cache-to: type=registry,mode=max,ref=${{ env.DOCKER_IMAGE_CACHE_REF }}
88+
89+
- name: 'Update docker-compose.prod.yaml template file'
90+
run: |
91+
sed 's|#{IMAGE}#|${{ env.DOCKER_IMAGE }}|g' docker-compose.prod.tmpl.yaml > docker-compose.prod.yaml
92+
93+
- name: 'Apply updated docker-compose.prod.yaml config to staging slot'
94+
run: |
95+
az webapp config container set --multicontainer-config-type COMPOSE --multicontainer-config-file docker-compose.prod.yaml --slot staging -n ghdocs-prod -g docs-prod
96+
97+
# Watch staging slot instances to see when all the instances are ready
98+
- name: Check that staging slot is ready
99+
uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
100+
env:
101+
CHECK_INTERVAL: 10000
102+
with:
103+
script: |
104+
const { execSync } = require('child_process')
105+
106+
const getStatesForSlot = (slot) => {
107+
return JSON.parse(
108+
execSync(
109+
`az webapp list-instances --slot ${slot} --query "[].state" -n ghdocs-prod -g docs-prod`,
110+
{ encoding: 'utf8' }
111+
)
112+
)
113+
}
114+
115+
let hasStopped = false
116+
const waitDuration = parseInt(process.env.CHECK_INTERVAL, 10) || 10000
117+
async function doCheck() {
118+
const states = getStatesForSlot('staging')
119+
console.log(`Instance states:`, states)
120+
121+
// We must wait until at-least 1 instance has STOPPED to know we're looking at the "next" deployment and not the "previous" one
122+
// That way we don't immediately succeed just because all the previous instances were READY
123+
if (!hasStopped) {
124+
hasStopped = states.some((s) => s === 'STOPPED')
125+
}
126+
127+
const isAllReady = states.every((s) => s === 'READY')
128+
129+
if (hasStopped && isAllReady) {
130+
process.exit(0) // success
131+
}
132+
133+
console.log(`checking again in ${waitDuration}ms`)
134+
setTimeout(doCheck, waitDuration)
135+
}
136+
137+
doCheck()
138+
139+
# TODO - make a request to verify the staging app version aligns with *this* github action workflow commit sha
140+
- name: 'Swap staging slot to production'
141+
run: |
142+
az webapp deployment slot swap --slot staging --target-slot production -n ghdocs-prod -g docs-prod
143+
144+
- name: Purge Fastly edge cache
145+
env:
146+
FASTLY_TOKEN: ${{ secrets.FASTLY_TOKEN }}
147+
FASTLY_SERVICE_ID: ${{ secrets.FASTLY_SERVICE_ID }}
148+
FASTLY_SURROGATE_KEY: 'every-deployment'
149+
run: npm install got && .github/actions-scripts/purge-fastly-edge-cache.js
150+
151+
- name: Send Slack notification if workflow failed
152+
uses: someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
153+
if: ${{ failure() }}
154+
with:
155+
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
156+
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
157+
color: failure
158+
text: Production deployment (Azure) failed at commit ${{ github.sha }}. See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

.github/workflows/browser-test.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,5 @@ jobs:
5959
path: .next/cache
6060
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}
6161

62-
- name: Cache lib/redirects/.redirects-cache_en_ja.json
63-
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
64-
with:
65-
path: lib/redirects/.redirects-cache_en_ja.json
66-
key: ${{ runner.os }}-redirects-cache-${{ hashFiles('.github/workflows/browser-test.yml') }}
67-
6862
- name: Run browser-test
6963
run: npm run browser-test

.github/workflows/create-translation-batch-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
- name: 'Setup node'
119119
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561
120120
with:
121-
node-version: '16'
121+
node-version: 16.14.x
122122

123123
- run: npm ci
124124

.github/workflows/move-ready-to-merge-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: move PR
2525
uses: alex-page/github-project-automation-plus@bb266ff4dde9242060e2d5418e120a133586d488
2626
with:
27-
project: Docs team reviews
27+
project: Docs open source board
2828
column: Triage
2929
repo-token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
3030

.github/workflows/openapi-decorate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
# so we need to specify the PR head ref explicitly since we're making
3838
# changes that we want to commit to the branch.
3939
ref: ${{ github.event.pull_request.head.ref }}
40+
# Using a PAT is necessary so that the new commit will trigger the
41+
# CI in the PR. (Events from GITHUB_TOKEN don't trigger new workflows.)
42+
token: ${{ secrets.DOCUBOT_REPO_PAT }}
4043

4144
- name: Setup node
4245
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561

0 commit comments

Comments
 (0)