mirror of
https://github.com/Dokploy/cli.git
synced 2026-06-15 20:25:22 +02:00
chore: update GitHub Actions workflow for release and npm checks
- Enhanced version checking logic in onPushToMain.yml to verify the existence of GitHub releases and npm versions before creating new releases or publishing to npm. - Updated the GitHub release action to use softprops/action-gh-release for improved functionality and added generation of release notes.
This commit is contained in:
35
.github/workflows/onPushToMain.yml
vendored
35
.github/workflows/onPushToMain.yml
vendored
@@ -30,31 +30,34 @@ jobs:
|
|||||||
id: version-check
|
id: version-check
|
||||||
run: |
|
run: |
|
||||||
package_version=$(node -p "require('./package.json').version")
|
package_version=$(node -p "require('./package.json').version")
|
||||||
exists=$(gh api repos/${{ github.repository }}/releases/tags/v$package_version >/dev/null 2>&1 && echo "true" || echo "")
|
echo "version=$package_version" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
if [ -n "$exists" ]; then
|
if gh api repos/${{ github.repository }}/releases/tags/v$package_version >/dev/null 2>&1; then
|
||||||
echo "Version v$package_version already exists"
|
echo "GitHub release v$package_version already exists, skipping"
|
||||||
echo "skipped=true" >> $GITHUB_OUTPUT
|
echo "release_exists=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "Version v$package_version does not exist"
|
echo "release_exists=false" >> $GITHUB_OUTPUT
|
||||||
echo "skipped=false" >> $GITHUB_OUTPUT
|
fi
|
||||||
echo "tag=v$package_version" >> $GITHUB_OUTPUT
|
|
||||||
|
if npm view @dokploy/cli@$package_version version >/dev/null 2>&1; then
|
||||||
|
echo "npm version $package_version already exists, skipping"
|
||||||
|
echo "npm_exists=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "npm_exists=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
- name: Create Github Release
|
- name: Create GitHub Release
|
||||||
if: steps.version-check.outputs.skipped == 'false'
|
if: steps.version-check.outputs.release_exists == 'false'
|
||||||
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.version-check.outputs.tag }}
|
tag_name: v${{ steps.version-check.outputs.version }}
|
||||||
tag: ${{ steps.version-check.outputs.tag }}
|
name: v${{ steps.version-check.outputs.version }}
|
||||||
commit: ${{ github.ref_name }}
|
generate_release_notes: true
|
||||||
token: ${{ github.token }}
|
|
||||||
skipIfReleaseExists: true
|
|
||||||
|
|
||||||
- name: Publish to npm
|
- name: Publish to npm
|
||||||
if: steps.version-check.outputs.skipped == 'false'
|
if: steps.version-check.outputs.npm_exists == 'false'
|
||||||
run: pnpm publish --no-git-checks
|
run: pnpm publish --no-git-checks
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|||||||
Reference in New Issue
Block a user