Skip to content

8.6.5

8.6.5 #15

Workflow file for this run

name: after-release
on:
release:
types: [ published ]
permissions: {}
env:
RELEASE_DATE: ${{ github.event.release.published_at }}
RELEASE_NOTES: ${{ github.event.release.body }}
RELEASE_URL: ${{ github.event.release.html_url }}
RELEASE_VERSION: ${{ github.event.release.tag_name }}
jobs:
update-changelog:
runs-on: [ ubuntu-latest ]
if: github.event_name == 'release' && github.event.repository.fork == false
concurrency:
group: '${{ github.workflow }}-changelog'
cancel-in-progress: false
steps:
- name: Generate GitHub application token
id: generate-application-token
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
with:
app-id: ${{ secrets.POLLY_UPDATER_BOT_APP_ID }}
private-key: ${{ secrets.POLLY_UPDATER_BOT_KEY }}
permission-contents: write
permission-pull-requests: write
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
filter: 'tree:0'
persist-credentials: true # zizmor: ignore[artipacked] Needed to push commits
show-progress: false
token: ${{ steps.generate-application-token.outputs.token }}
- name: Update Polly version
shell: pwsh
run: ./eng/bump-version.ps1 ${env:RELEASE_VERSION}
- name: Update CHANGELOG
shell: pwsh
run: ./eng/update-changelog.ps1 ${env:RELEASE_VERSION} ${env:RELEASE_NOTES} ${env:GITHUB_SERVER_URL}
- name: Update public API baselines
shell: pwsh
run: ./eng/update-baselines.ps1
- name: Push changes to GitHub
id: push-changes
shell: pwsh
env:
GIT_COMMIT_USER_EMAIL: '138034000+polly-updater-bot[bot]@users.noreply.github.com'
GIT_COMMIT_USER_NAME: 'polly-updater-bot[bot]'
run: |
$gitStatus = (git status --porcelain)
if ([string]::IsNullOrEmpty($gitStatus)) {
throw "No changes to commit."
}
git config color.diff always
git --no-pager diff
$branchName = "changelog-${env:RELEASE_VERSION}"
git config user.email ${env:GIT_COMMIT_USER_EMAIL} | Out-Null
git config user.name ${env:GIT_COMMIT_USER_NAME} | Out-Null
git fetch origin --no-tags | Out-Null
git rev-parse --verify --quiet "remotes/origin/${branchName}" | Out-Null
if ($LASTEXITCODE -eq 0) {
Write-Output "Branch ${branchName} already exists."
exit 0
}
git checkout -b $branchName
git add .
git commit -m "Update CHANGELOG`n`nUpdate CHANGELOG and samples for v${env:RELEASE_VERSION}." -s
git push -u origin $branchName
"branch-name=${branchName}" >> ${env:GITHUB_OUTPUT}
"updated-version=true" >> ${env:GITHUB_OUTPUT}
- name: Create pull request
if: steps.push-changes.outputs.updated-version == 'true'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
BASE_BRANCH: ${{ github.event.repository.default_branch }}
HEAD_BRANCH: ${{ steps.push-changes.outputs.branch-name }}
with:
github-token: ${{ steps.generate-application-token.outputs.token }}
script: |
const version = process.env.RELEASE_VERSION;
const { repo, owner } = context.repo;
const releaseUrl = process.env.RELEASE_URL;
const workflowUrl = `${process.env.GITHUB_SERVER_URL}/${owner}/${repo}/actions/runs/${process.env.GITHUB_RUN_ID}`;
const { data: pr } = await github.rest.pulls.create({
title: 'Bump version and update CHANGELOG',
owner,
repo,
head: process.env.HEAD_BRANCH,
base: process.env.BASE_BRANCH,
draft: true,
body: [
`Update CHANGELOG and samples version for [v${version}](${releaseUrl}).`,
'',
`This pull request was generated by [GitHub Actions](${workflowUrl}).`
].join('\n')
});
core.notice(`Created pull request ${owner}/${repo}#${pr.number}: ${pr.html_url}`);
update-milestone:
runs-on: [ ubuntu-latest ]
if: github.event.repository.fork == false
concurrency:
group: '${{ github.workflow }}-milestone'
cancel-in-progress: false
permissions:
issues: write
steps:
- name: Close milestone
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const { repo, owner } = context.repo;
const { data: milestones } = await github.rest.issues.listMilestones({
owner,
repo,
state: 'open',
});
const milestone = milestones.find((p) => p.title === `v${process.env.RELEASE_VERSION}`);
if (!milestone) {
return;
}
try {
await github.rest.issues.updateMilestone({
owner,
repo,
milestone_number: milestone.number,
state: 'closed',
due_on: process.env.RELEASE_DATE,
});
} catch (error) {
// Ignore
}