feat: add a release workflow

This commit is contained in:
Félix MARQUET
2025-11-13 15:06:18 +00:00
parent a9eb496d11
commit 8dc2f9c171
3 changed files with 69 additions and 0 deletions

View File

@@ -4,7 +4,9 @@ updates:
directory: "/"
schedule:
interval: "weekly"
target-branch: "dev"
- package-ecosystem: "github-actions"
directory: "/.github/workflows"
schedule:
interval: "weekly"
target-branch: "dev"

65
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,65 @@
name: Release
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22, 24, latest]
steps:
- uses: actions/checkout@v5
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- run: npm install prom-client
- run: npm install
- run: npm run lint
- run: npm test
- run: npm run test-types
publish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Use Node.js 18
uses: actions/setup-node@v6
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Get version
id: get_version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Generate Changelog
run: |
# Simple changelog generation
echo "# Changelog" > CHANGELOG.md
git log --oneline --pretty=format:"- %s" $(git describe --tags --abbrev=0 2>/dev/null || echo "HEAD~1")..HEAD >> CHANGELOG.md
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: Release v${{ steps.get_version.outputs.version }}
body_path: CHANGELOG.md
draft: false
prerelease: false

View File

@@ -4,9 +4,11 @@ on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
test: