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
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
# --- NPM: security only ----
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 0
groups:
npm-security:
applies-to: security-updates
patterns: [ "*" ]
labels: [ "security", "testing" ]
cooldown:
default-days: 7

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns: [ "*" ]
cooldown:
default-days: 7
63 changes: 45 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,56 @@ env:
jobs:
build:
runs-on: ubuntu-latest
container: node:26
container: node:24
permissions:
contents: write
checks: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@12cd2235efa0937479335606d7c3ac9f6c0973b1 # v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
fetch-depth: 0
token: ${{ secrets.ACCESS_TOKEN_GITHUB }}
persist-credentials: true

- name: npm install
run: npm install

- name: npm run build
run: npm run build

- name: npm run test
run: npm run test

- name: Commit and Push
id: commit
- name: Configure Git
run: |
git config --global user.email ${GITHUB_ACTOR}@users.noreply.github.com
git config --global user.name "github-actions[bot]"
git config --global --add safe.directory /__w/github-action-generate-semver/github-action-generate-semver

git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Setup pnpm and Node.js
uses: pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2.0.2

- name: pnpm install
run: pnpm install

- name: pnpm run build
run: pnpm run build

- name: pnpm run test
run: pnpm exec node --test --test-reporter=spec --test-reporter=junit --test-reporter-destination=stdout --test-reporter-destination=test-results.xml test.js

- name: Publish Test Report
uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6.4.2
if: ${{ !cancelled() }}
with:
report_paths: 'test-results.xml'
detailed_summary: true
include_passed: true
group_suite: true
resolve_ignore_classname: true
check_title_template: '{{TEST_NAME}}'

- name: Remove Test Report
if: always()
run: rm -f test-results.xml

- name: Commit and Push
id: commit
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "changed=0">> $GITHUB_OUTPUT
echo "No changes"
Expand All @@ -69,10 +94,12 @@ jobs:
git commit -m "Build Release"
git push

- uses: ./
- name: Generate Semantic Version
uses: ./
with:
github_token: ${{ secrets.ACCESS_TOKEN_GITHUB }}
github_token: ${{ secrets.GITHUB_TOKEN }}
bump: ${{ env.bump }}
prerelease_version: ${{ env.prerelease_version }}
dry_run: ${{ env.dry_run }}
detect_bump: true
create_release: ${{ github.event_name == 'push' }}
detect_bump: ${{ github.event_name == 'push' }}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Add the following step to your workflow:
filter_by_prefix: # optional, default: false
prefix: v # optional, default: "v"
prerelease_version: # optional, version to append for prerelease
create_release: false # optional, default: false
release_name: # optional, name of the release (default: version tag)
```

## Commit Message Detection
Expand Down Expand Up @@ -48,6 +50,8 @@ This detection overrides any value specified in the `bump` input.
| `filter_by_prefix` | If set, only consider tags that start with this prefix when calculating the new version | No | false |
| `prerelease_version` | String to append for prerelease versions | No | |
| `detect_bump` | If `true`, automatically detect the type of bump based on commit messages. This will override the specified bump. | No | true |
| `create_release` | If `true`, also create a GitHub release for the new tag | No | false |
| `release_name` | Name of the GitHub release. Defaults to the version tag. | No | |

## Outputs

Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ inputs:
description: 'If true, detect the type of bump to make based on the commit messages.'
required: false
default: 'true'
create_release:
description: 'If true, create a GitHub release when creating the tag.'
required: false
default: 'false'
release_name:
description: 'Name of the GitHub release. Defaults to the version tag.'
required: false
default: ''
outputs:
version:
description: 'The new semantic version that was calculated.'
Expand Down
Loading