mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-04 15:26:52 +00:00
feat(cli): add standalone CLI tool for semantic versioning
This commit is contained in:
parent
bdf7908364
commit
726912b971
55 changed files with 2305 additions and 2850 deletions
128
.github/workflows/ci.yml
vendored
Normal file
128
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- "feature/*"
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Test
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Format check
|
||||
run: npm run format-check
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
||||
- name: Package
|
||||
run: npm run package
|
||||
|
||||
- name: Run Action
|
||||
uses: ./
|
||||
id: run
|
||||
with:
|
||||
debug: true
|
||||
|
||||
- name: Print version
|
||||
run: echo "Version ${{ steps.run.outputs.version }}"
|
||||
env:
|
||||
DEBUG_OUTPUT: ${{ steps.run.outputs.debug_output }}
|
||||
|
||||
release:
|
||||
name: Publish Release
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
environment: release
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "npm"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Package
|
||||
run: npm run package
|
||||
|
||||
- name: Extract version from tag
|
||||
id: tag
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update package.json version
|
||||
run: npm version ${{ steps.tag.outputs.version }} --no-git-tag-version
|
||||
|
||||
- name: Publish to npm
|
||||
run: npm publish --provenance --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Update major version tag
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -fa v${{ steps.tag.outputs.major }} -m "Update v${{ steps.tag.outputs.major }} to ${{ steps.tag.outputs.version }}"
|
||||
git push origin v${{ steps.tag.outputs.major }} --force
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
generate_release_notes: true
|
||||
body: |
|
||||
## Installation
|
||||
|
||||
### GitHub Action
|
||||
```yaml
|
||||
- uses: paulhatch/semantic-version@v${{ steps.tag.outputs.major }}
|
||||
```
|
||||
|
||||
### CLI
|
||||
```bash
|
||||
npm install -g @semanticversion/cli
|
||||
```
|
||||
35
.github/workflows/test.yml
vendored
35
.github/workflows/test.yml
vendored
|
|
@ -1,35 +0,0 @@
|
|||
name: "Build"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- "feature/*"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: "Test and Run"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: NPM Install
|
||||
run: npm ci
|
||||
- name: Test
|
||||
run: npm test
|
||||
- name: Package
|
||||
run: npm run package
|
||||
- name: Run Action
|
||||
uses: ./
|
||||
id: run
|
||||
with:
|
||||
debug: true
|
||||
- name: Print Diagnostic Output
|
||||
run: echo $DEBUG_OUTPUT
|
||||
env:
|
||||
DEBUG_OUTPUT: ${{ steps.run.outputs.debug_output }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue