Skip to content

Generate Public Release Notes #16

Generate Public Release Notes

Generate Public Release Notes #16

# @file: D10-GeneratePublicRelease.yml
# This Action cascades from D10-Publish.yml action.
# This Action checks out the desired branch of the public repo, Tags the branch
# and drafts a templated release notes file.
#
# Attached resources:
# - GitHub SECRETS:
# -> local: PUBLISH_GITHUB_TOKEN -> SSH key used to connect to Acquia GitLab for remote git operations
# -> local: PUBLIC_REPO_TARGET -> URL of the public repo to be updated
# -> local: PUBLIC_REPO_TARGET_BRANCH -> Branch of the public repo to be updated
# -> global: SLACK_DOIT_WEBHOOK_URL -> Webhook URL for posting messages to slack
# - GitHub VARIABLES:
# -> local.SLACK_MONITORING_CHANNEL -> Channel for failure notices
# -> local.DRY_RUN -> Stops changes being passed back to GitHub
# -> local.LAST_TAG -> Records The previous tag used to tag the private repo
# -> local.THIS_TAG -> Records The tag used to tag the private repo for this publish
# -> local.THIS_RELEASE -> Records the release number for this publish
# -> local.THIS_TITLE -> Records the Pull Request title
# -> local.THIS_BODY -> Records the Pull Request body text
name: "Generate Public Release Notes"
on:
workflow_dispatch:
workflow_run:
types:
- completed
workflows: [Publish to Public Repo]
branches: [master]
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
TITLE: ${{ vars.THIS_TITLE }}
TAG: ${{ vars.THIS_TAG }}
RELEASE_NOTES: "[PM to complete]"
RELEASE_NUMBER: ${{ vars.THIS_RELEASE }}
WORKING_FILE: "CHANGELOG.md"
REPOSITORY: CityOfBoston/boston.gov
DRAFT: true # true = ReleaseNote is draft - false is published
jobs:
MakeRelease:
# installed software: https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
defaults:
run:
shell: bash
steps:
#
# Create the GitHub PUBLIC repo Release Note.
- name: Generate Release Notes
run: |
printf "## ${{ env.TITLE }}
### Release By
${{ github.author }}
### Release Notes
${{ env.RELEASE_NOTES }}" > ${{ env.WORKING_FILE }}
[[ ${{ vars.DRY_RUN }} == 1 ]] && cat ${{ env.WORKING_FILE }} || echo "Release Note Saved"
#
# Commit the release notes
- name: Commit Release Notes
if: ${{ vars.DRY_RUN == 0 }}
uses: softprops/action-gh-release@v2
with:
body_path: ${{ env.WORKING_FILE }}
draft: ${{ env.DRAFT }}
name: ${{ env.RELEASE_NUMBER }}
tag_name: ${{ env.TAG }}
repository: ${{ env.REPOSITORY }}
generate_release_notes: true
#
# Send FAIL message to slack.
- name: Post to Slack - failure
uses: act10ns/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DOIT_WEBHOOK_URL }}
if: ${{ failure() }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: ${{ vars.SLACK_MONITORING_CHANNEL }}
message: There were issues generating draft release notes for the PUBLIC repo {{workflowRunUrl}}