Create release with template and release notes #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Draft Release | |
on: | |
workflow_dispatch: | |
pull_request: | |
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: | | |
# Get the latest release tag | |
latest_release=$( | |
gh api \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/mozilla/addons-server/releases/latest | |
) | |
latest_tag=$(echo $latest_release | jq -r '.tag_name') | |
cat <<EOF | |
$latest_release | |
EOF | |
# Cat the file ../release-template.md | |
template=$(cat .github/release-template.md) | |
# Replace {{GITHUB_USER}} in template with ${{ github.actor }} | |
template=${template//\{\{GITHUB_USER\}\}/${{ github.actor }}} | |
gh release create $latest_tag-next \ | |
--target master \ | |
--notes "$template" \ | |
--draft |