Skip to content

Commit 19c6919

Browse files
authored
Merge branch 'main' into patch-2
2 parents f8a3538 + 9c6b311 commit 19c6919

File tree

5,726 files changed

+579048
-745495
lines changed

Some content is hidden

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

5,726 files changed

+579048
-745495
lines changed

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

Lines changed: 16 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,50 @@ 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.

.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.'
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/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)