Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix versioning #517

Merged
merged 3 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ on:
default: 'auto'
options:
- 'auto'
- 'major'
- 'minor'
- 'patch'
# - 'major'
# - 'minor'
# - 'patch'

jobs:
analyse-changed-packages:
Expand Down Expand Up @@ -77,6 +77,19 @@ jobs:

- run: echo "package=${{ matrix.package }}"

- name: Get pnpm store directory
id: pnpm-store
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: get directory for package
id: get-directory
run: |
Expand Down Expand Up @@ -107,62 +120,63 @@ jobs:
changelog=''

if ( ${{ inputs.releaseVersion == 'auto' }} ); then
changelog=`pnpm dlx standard-version --path . -t $MATRIX_PACKAGE@v --dry-run | sed -n '/^---$/,/^---$/p' | grep -v '^---$'`
changelog=`pnpm dlx commit-and-tag-version --path . -t $MATRIX_PACKAGE@v --dry-run | sed -n '/^---$/,/^---$/p' | grep -v '^---$'`
else
changelog=`pnpm dlx standard-version --path . -t $MATRIX_PACKAGE@v --release-as '${{ inputs.releaseVersion }}' --dry-run | sed -n '/^---$/,/^---$/p' | grep -v '^---$'`
changelog=`pnpm dlx commit-and-tag-version --path . -t $MATRIX_PACKAGE@v --release-as '${{ inputs.releaseVersion }}' --dry-run | sed -n '/^---$/,/^---$/p' | grep -v '^---$'`
fi

echo "$changelog"
echo "{${{ matrix.package }} v$changelog}" >> $GITHUB_STEP_SUMMARY
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "$changelog"
echo "changelog=$changelog" >> $GITHUB_OUTPUT
echo "${{ matrix.package }} v$changelog" >> $GITHUB_STEP_SUMMARY

working-directory: ${{ steps.get-directory.outputs.directory }}
env:
MATRIX_PACKAGE: ${{ matrix.package }}

- name: Determine next version number
if: inputs.releaseVersion == 'auto'
run: |
nextVersion=`pnpm dlx standard-version --path . -t $MATRIX_PACKAGE@v --dry-run | sed -n '/^---$/,/^---$/p' | grep -P -o '(\d+\.)(\d+\.)(\d)' | head -n 1`
nextVersion=`pnpm dlx commit-and-tag-version --path . -t $MATRIX_PACKAGE@v --dry-run | sed -n '/^---$/,/^---$/p' | grep -P -o '(\d+\.)(\d+\.)(\d)' | head -n 1`
echo "$nextVersion"
echo "NEXT_VERSION=$nextVersion" >> $GITHUB_ENV
working-directory: ${{ steps.get-directory.outputs.directory }}
env:
MATRIX_PACKAGE: ${{ matrix.package }}

- name: Manually next version number
if: inputs.releaseVersion != 'auto'
run: |
echo "NEXT_VERSION=${{ inputs.releaseVersion }}" >> $GITHUB_ENV
echo "$NEXT_VERSION"
# - name: Manually next version number
# if: inputs.releaseVersion != 'auto'
# run: |
# echo "NEXT_VERSION=${{ inputs.releaseVersion }}" >> $GITHUB_ENV
# echo "$NEXT_VERSION"

- name: bump version - DRY RUN
if: inputs.dryRun == true
run: |
if ( ${{ inputs.releaseVersion == 'auto' }} ); then
pnpm dlx standard-version --path . -t $MATRIX_PACKAGE@v --dry-run
pnpm dlx commit-and-tag-version --path . -t $MATRIX_PACKAGE@v --dry-run
else
pnpm dlx standard-version --path . -t $MATRIX_PACKAGE@v --release-as '${{ inputs.releaseVersion }}' --dry-run
pnpm dlx commit-and-tag-version --path . -t $MATRIX_PACKAGE@v --release-as '${{ inputs.releaseVersion }}' --dry-run
fi
working-directory: ${{ steps.get-directory.outputs.directory }}
env:
MATRIX_PACKAGE: ${{ matrix.package }}

- name: bump version - AUTOMATIC
if: inputs.dryRun == false && inputs.releaseVersion == 'auto'
run: pnpm dlx standard-version --path . -t $MATRIX_PACKAGE@v
run: pnpm dlx commit-and-tag-version --path . -t $MATRIX_PACKAGE@v
working-directory: ${{ steps.get-directory.outputs.directory }}
env:
MATRIX_PACKAGE: ${{ matrix.package }}

- name: bump version - MANUAL VERSION NO.
if: inputs.dryRun == false && inputs.releaseVersion != 'auto'
run: pnpm dlx standard-version --path . -t $MATRIX_PACKAGE@v --release-as '${{ inputs.releaseVersion }}'
working-directory: ${{ steps.get-directory.outputs.directory }}
env:
MATRIX_PACKAGE: ${{ matrix.package }}
# - name: bump version - MANUAL VERSION NO.
# if: inputs.dryRun == false && inputs.releaseVersion != 'auto'
# run: pnpm dlx commit-and-tag-version --path . -t $MATRIX_PACKAGE@v --release-as '${{ inputs.releaseVersion }}'
# working-directory: ${{ steps.get-directory.outputs.directory }}
# env:
# MATRIX_PACKAGE: ${{ matrix.package }}

- name: Publish tag # only possible on default branch
if: inputs.dryRun == false
Expand Down
36 changes: 36 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"types": [
{
"type": "feat",
"section": "🚀 Feature"
},
{
"type": "fix"
},
{
"type": "chore"
},
{
"type": "docs"
},
{
"type": "style"
},
{
"type": "refactor"
},
{
"type": "perf"
},
{
"type": "test"
},
{
"type": "ci",
"section": "👷 CI/CD"
},
{
"type": "build"
}
]
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"eslint-plugin-jest": "^27.4.0",
"eslint-plugin-prettier": "^5.0.0",
"prettier": "^3.0.3",
"standard-version": "^9.5.0",
"turbo": "^1.10.14"
}
}
Loading