Skip to content

Commit

Permalink
Merge pull request #37 from department-of-veterans-affairs/feature/70…
Browse files Browse the repository at this point in the history
…53-narin-automate-changelog

[Feature] Automate changelog generation for non-alpha/beta releases
  • Loading branch information
narin authored Nov 28, 2023
2 parents 71d4f42 + 51ebe12 commit 684d5e5
Show file tree
Hide file tree
Showing 9 changed files with 311 additions and 219 deletions.
9 changes: 7 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<!-- Preferred branch and PR naming convention:

<!-- Preferred PR naming convention:
'[Issue type] – Brief summary of issue suitable for changelog',
where Issue type = bug, feature, spike, CU (code upkeep), etc.-->

<!-- Preferred branch naming convention:
'[Issue type]/[Issue #]-[Your name]-[Summary of issue]',
where Issue type = bug, feature, spike, CU (code upkeep), etc.-->

Expand Down Expand Up @@ -54,5 +59,5 @@ Code reviewer validation:
<!-- Most changes entail a version increment; section can be removed for PRs exclusively within non-ship-relevant files (e.g. unit tests, Storybook stories) -->
If changes warrant a new version [per the versioning guidelines](https://github.com/department-of-veterans-affairs/va-mobile-library#versioning-policy) and the PR is approved and ready to merge:
- [ ] Merge `main` into branch
- [ ] [Publish new version](https://github.com/department-of-veterans-affairs/va-mobile-library/actions/workflows/publish.yml)
- [ ] Merge branch to `main`
- [ ] [Publish new version](https://github.com/department-of-veterans-affairs/va-mobile-library/actions/workflows/publish.yml)
38 changes: 38 additions & 0 deletions .github/scripts/generate-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
# This script creates a regex string based on the passed package
# in order to generate a changelog that filters out the other
# packages in this monorepo.

# Check if 'packages', 'current_package' and 'token' are provided as command line arguments
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <current_package> <token>"
exit 1
fi

# Assign command line arguments to variables
current_package="$1"
token="$2"

# Get list of packages based on directories in packages/
packages=(../../packages/*/)
packages=("${packages[@]%/}")
packages=("${packages[@]##*/}")

# Filter out current package
filtered_array=()
for value in "${packages[@]}"
do
[[ $value != $current_package ]] && filtered_array+=($value)
done

# Add regex to each item in array
filtered_array=( "${filtered_array[@]/%/-.*}" )

# Join strings with pipe char
joined_string=$(IFS="|"; echo "${filtered_array[*]}")

# Build full regex string
regex="(.*-(alpha|beta).*|$joined_string)"
echo "Regex: $regex"

bundle exec github_changelog_generator -u department-of-veterans-affairs -p va-mobile-library -t $token --exclude-tags-regex $regex --no-unreleased
24 changes: 17 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,26 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}
steps:
- name: 'Checkout repo'
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.VA_MOBILE_ROBOT_GITHUB_PAT }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
working-directory: ${{ github.workspace }}
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org/
node-version-file: '.nvmrc'
- run: yarn install
cache: yarn
- run: |
yarn install
cd ../../
yarn install
- name: Bump version and publish to NPM
id: bump-version
run: |
Expand Down Expand Up @@ -76,12 +85,17 @@ jobs:
echo "NEW_VERSION=$NEW_VERSION" >> "$GITHUB_OUTPUT"
echo "GIT_TAG=${{ inputs.package }}-v$NEW_VERSION" >> "$GITHUB_OUTPUT"
- name: Commit package.json changes and tag
- name: Generate changelog
run: |
chmod +x ../../.github/scripts/generate-changelog.sh
./../../.github/scripts/generate-changelog.sh ${{ inputs.package }} ${{ secrets.VA_MOBILE_ROBOT_GITHUB_PAT }}
- name: Commit changes and tag
run: |
git config --global user.name 'VA Automation Bot'
git config --global user.email 'va-mobileapp@adhocteam.us'
git pull
git add package.json
git add CHANGELOG.md
git commit -m 'Version bump: ${{ steps.bump-version.outputs.GIT_TAG }}'
git push
TAG=${{ steps.bump-version.outputs.GIT_TAG }}
Expand Down Expand Up @@ -131,7 +145,3 @@ jobs:
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_OAUTH_TOKEN }}
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
209 changes: 0 additions & 209 deletions CHANGELOG.md

This file was deleted.

3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "github_changelog_generator"
99 changes: 99 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
async (2.6.5)
console (~> 1.10)
fiber-annotation
io-event (~> 1.1)
timers (~> 4.1)
async-http (0.61.0)
async (>= 1.25)
async-io (>= 1.28)
async-pool (>= 0.2)
protocol-http (~> 0.25.0)
protocol-http1 (~> 0.16.0)
protocol-http2 (~> 0.15.0)
traces (>= 0.10.0)
async-http-faraday (0.12.0)
async-http (~> 0.42)
faraday
async-io (1.38.0)
async
async-pool (0.4.0)
async (>= 1.25)
base64 (0.2.0)
bigdecimal (3.1.4)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
console (1.23.2)
fiber-annotation
fiber-local
drb (2.2.0)
ruby2_keywords
faraday (2.7.12)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-http-cache (2.5.0)
faraday (>= 0.8)
faraday-net_http (3.0.2)
fiber-annotation (0.2.0)
fiber-local (1.0.0)
github_changelog_generator (1.16.4)
activesupport
async (>= 1.25.0)
async-http-faraday
faraday-http-cache
multi_json
octokit (~> 4.6)
rainbow (>= 2.2.1)
rake (>= 10.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
io-event (1.3.3)
minitest (5.20.0)
multi_json (1.15.0)
mutex_m (0.2.0)
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
protocol-hpack (1.4.2)
protocol-http (0.25.0)
protocol-http1 (0.16.0)
protocol-http (~> 0.22)
protocol-http2 (0.15.1)
protocol-hpack (~> 1.4)
protocol-http (~> 0.18)
public_suffix (5.0.4)
rainbow (3.1.1)
rake (13.1.0)
ruby2_keywords (0.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
timers (4.3.5)
traces (0.11.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
github_changelog_generator

BUNDLED WITH
2.4.22
84 changes: 84 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Changelog

## [components-v0.2.1](https://github.com/department-of-veterans-affairs/va-mobile-library/tree/components-v0.2.1) (2023-11-22)

[Full Changelog](https://github.com/department-of-veterans-affairs/va-mobile-library/compare/components-v0.2.0...components-v0.2.1)

**Merged pull requests:**

- feature/6860-roettger-DesignTokensForFigma [\#35](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/35) ([TimRoe](https://github.com/TimRoe))
- feature/6870-nr-vabutton [\#34](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/34) ([narin](https://github.com/narin))

## [components-v0.2.0](https://github.com/department-of-veterans-affairs/va-mobile-library/tree/components-v0.2.0) (2023-11-16)

[Full Changelog](https://github.com/department-of-veterans-affairs/va-mobile-library/compare/components-v0.0.31...components-v0.2.0)

**Merged pull requests:**

- CU/6700-roettger-MobileLibraryPRTemplate [\#33](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/33) ([TimRoe](https://github.com/TimRoe))
- 6857-roettger-FixRNWebDeprecatedAttribsOnSegmentedControl [\#32](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/32) ([TimRoe](https://github.com/TimRoe))
- 6989-roettger storybook missing dist folder locally [\#31](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/31) ([TimRoe](https://github.com/TimRoe))
- Bump browserify-sign from 4.2.1 to 4.2.2 [\#30](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/30) ([dependabot[bot]](https://github.com/apps/dependabot))
- Bump browserify-sign from 4.2.1 to 4.2.2 in /packages/components [\#29](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/29) ([dependabot[bot]](https://github.com/apps/dependabot))
- GHA Release Workflow [\#28](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/28) ([narin](https://github.com/narin))
- Bump @babel/traverse from 7.22.8 to 7.23.2 [\#27](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/27) ([dependabot[bot]](https://github.com/apps/dependabot))

## [components-v0.0.31](https://github.com/department-of-veterans-affairs/va-mobile-library/tree/components-v0.0.31) (2023-10-27)

[Full Changelog](https://github.com/department-of-veterans-affairs/va-mobile-library/compare/components-v0.0.30...components-v0.0.31)

## [components-v0.0.30](https://github.com/department-of-veterans-affairs/va-mobile-library/tree/components-v0.0.30) (2023-10-26)

[Full Changelog](https://github.com/department-of-veterans-affairs/va-mobile-library/compare/components-v0.0.29...components-v0.0.30)

## [components-v0.0.29](https://github.com/department-of-veterans-affairs/va-mobile-library/tree/components-v0.0.29) (2023-10-26)

[Full Changelog](https://github.com/department-of-veterans-affairs/va-mobile-library/compare/components-v0.0.28...components-v0.0.29)

## [components-v0.0.28](https://github.com/department-of-veterans-affairs/va-mobile-library/tree/components-v0.0.28) (2023-10-26)

[Full Changelog](https://github.com/department-of-veterans-affairs/va-mobile-library/compare/components-v0.0.27...components-v0.0.28)

## [components-v0.0.27](https://github.com/department-of-veterans-affairs/va-mobile-library/tree/components-v0.0.27) (2023-10-26)

[Full Changelog](https://github.com/department-of-veterans-affairs/va-mobile-library/compare/components-v0.0.26...components-v0.0.27)

## [components-v0.0.26](https://github.com/department-of-veterans-affairs/va-mobile-library/tree/components-v0.0.26) (2023-10-25)

[Full Changelog](https://github.com/department-of-veterans-affairs/va-mobile-library/compare/bfe7f18051ff4723b5e7085061f9b2749690d10d...components-v0.0.26)

**Closed issues:**

- Error: GitHub Repository Not Mapped To eMASS System [\#5](https://github.com/department-of-veterans-affairs/va-mobile-library/issues/5)
- Error: GitHub Repository Not Mapped To eMASS System [\#4](https://github.com/department-of-veterans-affairs/va-mobile-library/issues/4)

**Merged pull requests:**

- Bump @babel/traverse from 7.22.8 to 7.23.2 in /packages/components [\#26](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/26) ([dependabot[bot]](https://github.com/apps/dependabot))
- 6826 roettger segmented control storybook updates [\#25](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/25) ([TimRoe](https://github.com/TimRoe))
- Added CI check to require checkboxes be complete [\#24](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/24) ([timwright12](https://github.com/timwright12))
- Fix Storybook on Android [\#23](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/23) ([narin](https://github.com/narin))
- 6507 roettger add segmented control unit tests [\#22](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/22) ([TimRoe](https://github.com/TimRoe))
- Chore/6692 add nvm [\#21](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/21) ([timwright12](https://github.com/timwright12))
- Adding workflow to run checks against the VA Mobile App [\#20](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/20) ([timwright12](https://github.com/timwright12))
- Add testIDs prop to SegmentedControl [\#19](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/19) ([narin](https://github.com/narin))
- Add style-dictionary and generate initial tokens [\#18](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/18) ([narin](https://github.com/narin))
- Fix Storybook web [\#17](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/17) ([narin](https://github.com/narin))
- Updated repo name assets [\#16](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/16) ([timwright12](https://github.com/timwright12))
- Adding Storybook publishing workflow [\#15](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/15) ([timwright12](https://github.com/timwright12))
- 6407-roettger-implementSegmentedControlToApp [\#14](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/14) ([TimRoe](https://github.com/TimRoe))
- Automate Linting [\#13](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/13) ([narin](https://github.com/narin))
- Adding npm publish workflow [\#12](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/12) ([timwright12](https://github.com/timwright12))
- Storybook Docs template [\#11](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/11) ([narin](https://github.com/narin))
- 6509-roettger-segmentedControlStorybook [\#10](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/10) ([TimRoe](https://github.com/TimRoe))
- Added npm publish commands [\#9](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/9) ([timwright12](https://github.com/timwright12))
- 6353-roettger-CreateSegmentedControl [\#8](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/8) ([TimRoe](https://github.com/TimRoe))
- Figma Integration [\#7](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/7) ([narin](https://github.com/narin))
- Storybook Initial Setup [\#6](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/6) ([narin](https://github.com/narin))
- Action Required: Configure CodeQL [\#3](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/3) ([veterans-affairs-code-scanning](https://github.com/veterans-affairs-code-scanning))
- 6266-roettger-repoFoundationalStructure [\#2](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/2) ([TimRoe](https://github.com/TimRoe))
- Components automated tests [\#1](https://github.com/department-of-veterans-affairs/va-mobile-library/pull/1) ([narin](https://github.com/narin))



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@department-of-veterans-affairs/mobile-component-library",
"version": "0.2.2-alpha.16",
"version": "0.2.2-alpha.21",
"description": "VA Design System Mobile Component Library",
"main": "src/index.tsx",
"scripts": {
Expand Down
Loading

0 comments on commit 684d5e5

Please sign in to comment.