Merge pull request #36 from Dokploy/feat/add-support-for-all-endpoints #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release and publish | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| COREPACK_ENABLE_STRICT: 0 | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} | |
| - uses: pnpm/action-setup@v6 | |
| with: | |
| version: latest | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: latest | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| - run: pnpm install --ignore-scripts | |
| - run: pnpm run build | |
| - name: Check if version already exists | |
| id: version-check | |
| run: | | |
| 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 "") | |
| if [ -n "$exists" ]; then | |
| echo "Version v$package_version already exists" | |
| echo "skipped=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Version v$package_version does not exist" | |
| echo "skipped=false" >> $GITHUB_OUTPUT | |
| echo "tag=v$package_version" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Create Github Release | |
| if: steps.version-check.outputs.skipped == 'false' | |
| uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 | |
| with: | |
| name: ${{ steps.version-check.outputs.tag }} | |
| tag: ${{ steps.version-check.outputs.tag }} | |
| commit: ${{ github.ref_name }} | |
| token: ${{ secrets.GH_TOKEN }} | |
| skipIfReleaseExists: true | |
| - name: Publish to npm | |
| if: steps.version-check.outputs.skipped == 'false' | |
| run: pnpm publish --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |