mirror of
https://github.com/ivuorinen/gh-codeql-report.git
synced 2026-02-12 15:48:53 +00:00
chore: fixes to release workflow and release shortcuts
This commit is contained in:
44
.github/workflows/release.yml
vendored
44
.github/workflows/release.yml
vendored
@@ -1,8 +1,6 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
@@ -86,10 +84,33 @@ jobs:
|
|||||||
name: dist
|
name: dist
|
||||||
path: dist/
|
path: dist/
|
||||||
|
|
||||||
|
create-release:
|
||||||
|
name: Create GitHub Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, test, build]
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
|
|
||||||
|
- name: Download build artifacts
|
||||||
|
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.2.0
|
||||||
|
with:
|
||||||
|
generate_release_notes: true
|
||||||
|
files: |
|
||||||
|
dist/**/*
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish to npm
|
name: Publish to npm
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [lint, test, build]
|
needs: [lint, test, build, create-release]
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
@@ -110,7 +131,24 @@ jobs:
|
|||||||
- name: Build project
|
- name: Build project
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Check if version exists on npm
|
||||||
|
id: check-version
|
||||||
|
run: |
|
||||||
|
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
||||||
|
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
||||||
|
echo "version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
if npm view "$PACKAGE_NAME@$PACKAGE_VERSION" version 2>/dev/null; then
|
||||||
|
echo "exists=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "⚠️ Version $PACKAGE_VERSION already exists on npm, skipping publish"
|
||||||
|
else
|
||||||
|
echo "exists=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "✅ Version $PACKAGE_VERSION does not exist on npm, will publish"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Publish to npm
|
- name: Publish to npm
|
||||||
|
if: steps.check-version.outputs.exists == 'false'
|
||||||
run: npm publish --provenance --access public
|
run: npm publish --provenance --access public
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|||||||
@@ -32,7 +32,10 @@
|
|||||||
"lint": "biome check src/",
|
"lint": "biome check src/",
|
||||||
"lint:fix": "biome check --write .",
|
"lint:fix": "biome check --write .",
|
||||||
"format": "biome format --write .",
|
"format": "biome format --write .",
|
||||||
"prepare": "husky"
|
"prepare": "husky",
|
||||||
|
"release:patch": "npm version patch -m 'chore: release v%s' && git push origin main --follow-tags",
|
||||||
|
"release:minor": "npm version minor -m 'chore: release v%s' && git push origin main --follow-tags",
|
||||||
|
"release:major": "npm version major -m 'chore: release v%s' && git push origin main --follow-tags"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/yargs": "^17.0.33",
|
"@types/yargs": "^17.0.33",
|
||||||
|
|||||||
Reference in New Issue
Block a user