feat: use branch name instead of tag for stable docs (#32614)
* feat: use branch name instead of tag for stable docs Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com> * test Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com> * paginate everything Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com> * different return value Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com> * update both flows Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com> * add docs Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com> * Change checkout ref from tags to heads Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> --------- Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com> Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com>
This commit is contained in:
@@ -27,36 +27,37 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: find latest release
|
||||
- name: find latest release branch
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
id: find-release
|
||||
with:
|
||||
script: |
|
||||
const { data } = await github.rest.repos.listTags({
|
||||
const data = await octokit.paginate(github.rest.repos.listBranches, {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
per_page: 100,
|
||||
})
|
||||
|
||||
const [{tag}] = data
|
||||
const [{branch}] = data
|
||||
.map(i => i.name)
|
||||
.filter(tag => tag.match(/^v\d+\.\d+\.\d+$/))
|
||||
.map(tag => ({
|
||||
tag,
|
||||
val: tag
|
||||
.filter(branch => branch.match(/^patch\/v\d+\.\d+\.\d+$/))
|
||||
.map(branch => ({
|
||||
branch,
|
||||
val: branch
|
||||
.split('/')[1]
|
||||
.slice(1)
|
||||
.split('.')
|
||||
.reduce((val, part) => Number(val) * 1000 + Number(part))
|
||||
}))
|
||||
.sort((a, b) => b.val - a.val)
|
||||
|
||||
return tag
|
||||
return branch
|
||||
result-encoding: string
|
||||
|
||||
- name: checkout latest release
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
ref: refs/tags/${{ steps.find-release.outputs.result }}
|
||||
ref: refs/heads/${{ steps.find-release.outputs.result }}
|
||||
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
@@ -232,7 +233,7 @@ jobs:
|
||||
- name: checkout latest release
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
ref: refs/tags/${{ needs.stable.outputs.release }}
|
||||
ref: refs/heads/${{ needs.stable.outputs.release }}
|
||||
|
||||
- name: microsite yarn install
|
||||
run: yarn install --immutable
|
||||
|
||||
@@ -32,36 +32,37 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: find latest release
|
||||
- name: find latest release branch
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
id: find-release
|
||||
with:
|
||||
script: |
|
||||
const { data } = await github.rest.repos.listTags({
|
||||
const data = await octokit.paginate(github.rest.repos.listBranches, {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
per_page: 100,
|
||||
})
|
||||
|
||||
const [{tag}] = data
|
||||
const [{branch}] = data
|
||||
.map(i => i.name)
|
||||
.filter(tag => tag.match(/^v\d+\.\d+\.\d+$/))
|
||||
.map(tag => ({
|
||||
tag,
|
||||
val: tag
|
||||
.filter(branch => branch.match(/^patch\/v\d+\.\d+\.\d+$/))
|
||||
.map(branch => ({
|
||||
branch,
|
||||
val: branch
|
||||
.split('/')[1]
|
||||
.slice(1)
|
||||
.split('.')
|
||||
.reduce((val, part) => Number(val) * 1000 + Number(part))
|
||||
}))
|
||||
.sort((a, b) => b.val - a.val)
|
||||
|
||||
return tag
|
||||
return branch
|
||||
result-encoding: string
|
||||
|
||||
- name: checkout latest release
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
ref: refs/tags/${{ steps.find-release.outputs.result }}
|
||||
ref: refs/heads/${{ steps.find-release.outputs.result }}
|
||||
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
|
||||
Reference in New Issue
Block a user