Skip to content
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
63 changes: 63 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish to npm

on:
workflow_dispatch:
inputs:
confirm:
description: 'Type "publish" to confirm'
required: true
type: string

jobs:
publish:
runs-on: ubuntu-latest
if: inputs.confirm == 'publish'
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run clean-build

- name: Run tests
run: npm test

- name: Publish to npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Use NPM_TOKEN if available, otherwise fall back to NODE_AUTH_TOKEN
if [ -n "$NPM_TOKEN" ]; then
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
fi
npm publish --access public
# Clean up
rm -f .npmrc

- name: Get package version
id: package-version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT

- name: Create success summary
run: |
echo "## ✅ Package Published Successfully" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Package:** turkey-map-react@${{ steps.package-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**npm:** https://www.npmjs.com/package/turkey-map-react" >> $GITHUB_STEP_SUMMARY
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
workflow_dispatch:
inputs:
release_type:
description: 'Release type'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch
- prerelease

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Install dependencies
run: npm ci

- name: Run release script
run: ./scripts/release.sh ${{ inputs.release_type }}

- name: Push changes and tags
run: |
git push --follow-tags origin ${{ github.ref_name }}

- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=$(git describe --tags --abbrev=0)
CHANGELOG_CONTENT=$(awk -v ver="$TAG_NAME" '
$0 ~ "## \\[?"ver {found=1; next}
/^## \[?[0-9]/ && found {exit}
found {print}
' CHANGELOG.md | sed '/^$/d')

if [ -z "$CHANGELOG_CONTENT" ]; then
CHANGELOG_CONTENT="Release $TAG_NAME"
fi

gh release create "$TAG_NAME" \
--title "$TAG_NAME" \
--notes "$CHANGELOG_CONTENT" \
--verify-tag
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
*.lock
lib
.idea
.npmrc
46 changes: 46 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"hidden": true
},
{
"type": "docs",
"hidden": false,
"section": "Documentation"
},
{
"type": "style",
"hidden": true
},
{
"type": "refactor",
"hidden": false,
"section": "Refactoring"
},
{
"type": "perf",
"hidden": false,
"section": "Performance Improvements"
},
{
"type": "test",
"hidden": false,
"section": "Tests"
}
],
"commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}",
"compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}",
"issueUrlFormat": "{{host}}/{{owner}}/{{repository}}/issues/{{id}}",
"userUrlFormat": "{{host}}/{{user}}",
"releaseCommitMessageFormat": "chore(release): {{currentTag}}",
"issuePrefixes": ["#"]
}
46 changes: 43 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,55 @@ email, or any other method with the owners of this repository before making a ch

Please note we have a code of conduct, please follow it in all your interactions with the project.

## Commit Message Convention

This project uses [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages. This enables automated changelog generation and semantic versioning.

### Format

```
<type>(<scope>): <subject>

<body>

<footer>
```

### Types

- `feat`: A new feature (triggers MINOR version bump)
- `fix`: A bug fix (triggers PATCH version bump)
- `docs`: Documentation only changes
- `style`: Changes that don't affect code meaning
- `refactor`: Code change that neither fixes a bug nor adds a feature
- `perf`: Performance improvement
- `test`: Adding or updating tests
- `chore`: Changes to the build process or auxiliary tools

### Examples

```bash
feat: add custom tooltip support
fix: resolve rendering issue on mobile
docs: update installation instructions
test: add tests for tooltip component
```

For breaking changes, add `!` after type or `BREAKING CHANGE:` in footer:
```bash
feat!: remove deprecated API
```

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
3. Follow the commit message convention described above. The versioning is handled automatically
by the release script based on conventional commits. The versioning scheme we use is [SemVer](http://semver.org/).
4. Ensure all tests pass by running `npm test`
5. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.

## Code of Conduct
Expand Down
Loading