Skip to content

Commit

Permalink
Add brassy build workflow on new tag (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
mindyls authored Aug 16, 2024
2 parents 721b517 + 6765cdc commit e66f2d4
Show file tree
Hide file tree
Showing 2 changed files with 191 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/new-brassy-note.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Generate Release Note with Brassy

on:
workflow_dispatch:
push:
tags:
- '*'

jobs:
generate_release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Extract branch name
shell: bash
run: |
git rev-parse --abbrev-ref HEAD
echo ${{ github.ref }}
export raw=$(git branch -r --contains ${{ github.ref }})
echo $raw
branch=${raw##*/}
echo $branch
echo "branch=$branch" >> $GITHUB_OUTPUT
echo "Branch is $branch."
id: extract_branch


- name: Extract version
run: |
git fetch --quiet --tags origin # needed bc action above doesn't pull tags
export GEOIPS_VERS=`git -C . tag --sort=-creatordate | grep -v osr | head -n 1`
echo "version=$GEOIPS_VERS" >> $GITHUB_OUTPUT
echo "Version is $GEOIPS_VERS"
id: extract_version

- name: Install Brassy
run: |
pip3 install brassy
- name: Run Brassy on file
run: |
touch RELEASE_NOTE_HEADER
echo ".. dropdown:: Distribution Statement" >> RELEASE_NOTE_HEADER
echo " " >> RELEASE_NOTE_HEADER
echo " | # # # This source code is protected under the license referenced at" \
>> RELEASE_NOTE_HEADER
echo " | # # # https://github.com/NRLMMD-GEOIPS." \
>> RELEASE_NOTE_HEADER
export output_file=v$(echo "${{ steps.extract_version.outputs.version }}" | tr . _).rst
echo $output_file
brassy ./docs/source/releases/latest \
--output-file ./docs/source/releases/$output_file \
--prefix-file RELEASE_NOTE_HEADER \
--no-rich \
--release-version ${{ steps.extract_version.outputs.version }}
rm RELEASE_NOTE_HEADER
- name: Commit new release note and delete old yaml files
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'github-actions@github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout -b \
update-release-note-${{ steps.extract_branch.outputs.branch }}
git add ./docs/source/releases/*.rst
git commit -m "Add Built Release Note"
git rm ./docs/source/releases/latest/*.yaml
git commit -m "Remove old yaml files"
- name: Push new release note to branch
run: |
git push --set-upstream origin \
update-release-note-${{ steps.extract_branch.outputs.branch }}
- name: create pull request
run: |
gh pr create \
--base ${{ steps.extract_branch.outputs.branch }} \
--head update-release-note-${{ steps.extract_branch.outputs.branch }} \
--title \
'Merge new release note into ${{ steps.extract_branch.outputs.branch }}' \
--body 'Created by manually run Github action.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99 changes: 99 additions & 0 deletions docs/source/releases/latest/738-new-branch-brassy-on-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
bug fix:
- description: ''
files:
added:
- ''
related-issue:
number: 0
repo_url: ''
title: ''
continuous integration:
- description: 'Added workflow to build, commit and PR a built release note with brassy'
files:
added:
- '.github/workflows/new-brassy-note.yaml'
deleted:
- ''
modified:
- ''
moved:
- ''
related-issue:
number: 738
repo_url: ''
title: 'Auto-PR built release note on new tag'
deprecation:
- description: ''
files:
added:
- ''
deleted:
- ''
modified:
- ''
moved:
- ''
related-issue:
number: 0
repo_url: ''
title: ''
documentation:
- description: ''
files:
added:
- ''
deleted:
- ''
modified:
- ''
moved:
- ''
related-issue:
number: 0
repo_url: ''
title: ''
enhancement:
- description: ''
files:
added:
- ''
deleted:
- ''
modified:
- ''
moved:
- ''
related-issue:
number: 0
repo_url: ''
title: ''
performance:
- description: ''
files:
added:
- ''
deleted:
- ''
modified:
- ''
moved:
- ''
related-issue:
number: 0
repo_url: ''
title: ''
removal:
- description: ''
files:
added:
- ''
deleted:
- ''
modified:
- ''
moved:
- ''
related-issue:
number: 0
repo_url: ''
title: ''

0 comments on commit e66f2d4

Please sign in to comment.