Create release with template and release notes (#22622)
* Create release with template and release notes * TMP: update from comments * TMP: update release template with changelog sections * TMP: use release hero input for GITHUB_USER template variable * Rename LATEST -> PREVIOUS * TMP: apply typo fix
This commit is contained in:
Родитель
ab3c1c130a
Коммит
d63e7e7fb1
|
@ -0,0 +1,28 @@
|
|||
This week's push hero is @{{GITHUB_USER}}
|
||||
|
||||
Previous Release: [{{PREVIOUS_TAG}}]({{PREVIOUS_RELEASE_URL}})
|
||||
|
||||
## Blockers:
|
||||
|
||||
## Cherry-picks:
|
||||
|
||||
<!-- Link to the actual commits, NOT merge commits. The commits need to appear
|
||||
in chronological order so that `git cherry-pick` will apply them correctly. -->
|
||||
|
||||
## Before we push:
|
||||
|
||||
## Before we start:
|
||||
|
||||
## Before we promote:
|
||||
|
||||
## After we're done:
|
||||
|
||||
## Addons-Frontend Changelog:
|
||||
|
||||
<!-- Link to the tag comparison of the target tag and the previous tag for addons-frontend
|
||||
https://github.com/mozilla/addons-frontend/compare/<PREVIOUS_TAG...<CURRENT_TAG>
|
||||
-->
|
||||
|
||||
## Addons Server Changelog:
|
||||
|
||||
<!-- This section will be automatically populated once the release notes are auto generated -->
|
|
@ -0,0 +1,11 @@
|
|||
changelog:
|
||||
categories:
|
||||
- title: Notable things shipping
|
||||
labels:
|
||||
- '*'
|
||||
exclude:
|
||||
labels:
|
||||
- dependencies
|
||||
- title: Dependendabots
|
||||
labels:
|
||||
- dependencies
|
|
@ -0,0 +1,88 @@
|
|||
name: Draft Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
push_hero:
|
||||
description: The person responsible for facilitating the release.
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- kevinmind
|
||||
- diox
|
||||
- eviljeff
|
||||
tag:
|
||||
description: 'Release date YYYY.MM.DD Also used to generate the tag name.'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
draft_release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Create Release Draft
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -z "${{ github.event.inputs.tag }}" ]; then
|
||||
echo "Tag is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${{ github.event.inputs.push_hero }}" ]; then
|
||||
echo "Push hero is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Format current date as YYYY.MM.DD
|
||||
|
||||
if [[ "${{ github.event_name}}" == 'workflow_dispatch' ]]; then
|
||||
tag="${{ github.event.inputs.tag }}"
|
||||
fi
|
||||
|
||||
# Validate the tag is formatted correctly YYYY.MM.DD or YYYY.MM.DD-X
|
||||
# where X is a whole number greater than zero
|
||||
if [[ ! $tag =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]{2}(-[0-9]+)?$ ]]; then
|
||||
echo "Invalid tag format. Must be YYYY.MM.DD or YYYY.MM.DD-X"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify that a release with this tag does not already exist
|
||||
if gh release view $tag &> /dev/null; then
|
||||
echo "Release $tag-next already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the latest release tag
|
||||
previous_release=$(
|
||||
gh api \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
/repos/mozilla/addons-server/releases/latest
|
||||
)
|
||||
|
||||
previous_tag=$(echo $previous_release | jq -r '.tag_name')
|
||||
previous_release_url=$(echo $previous_release | jq -r '.html_url')
|
||||
|
||||
cat <<EOF
|
||||
$previous_release
|
||||
EOF
|
||||
|
||||
# Cat the file ../release-template.md
|
||||
template=$(cat .github/release-template.md)
|
||||
|
||||
# Replace {{GITHUB_USER}} in template with ${{ github.event.inputs.push_hero }}
|
||||
template=${template//\{\{GITHUB_USER\}\}/${{ github.event.inputs.push_hero }}}
|
||||
|
||||
# Replace {{PREVIOUS_TAG}} in template with $previous_tag
|
||||
template=${template//\{\{PREVIOUS_TAG\}\}/$previous_tag}
|
||||
|
||||
# Replace {{PREVIOUS_RELEASE_URL}} in template with $previous_release_url
|
||||
template=${template//\{\{PREVIOUS_RELEASE_URL\}\}/$previous_release_url}
|
||||
|
||||
gh release create $tag \
|
||||
--title $tag \
|
||||
--target master \
|
||||
--notes "$template" \
|
||||
--draft
|
Загрузка…
Ссылка в новой задаче