Skip to content

fix cicd

fix cicd #32

on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
packages: write
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{steps.release.outputs.release_created}}
steps:
- uses: actions/checkout@v3
- id: check_package_version
run: |
PACKAGE_VERSION=$(cat package.json | jq -r '.version')
echo "packge_version $PACKAGE_VERSION"
echo "packge_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
- run: |
echo "packge_version=${{steps.check_package_version.outputs.packge_version}}"
echo "prerelease=${{ contains(steps.check_package_version.outputs.packge_version, 'beta') }}"
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: react-leaflet-pouchdb-tilelayer
prerelease: ${{ contains(steps.check_package_version.outputs.packge_version, 'beta') }}
deploy:
runs-on: ubuntu-latest
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run build
- id: check_package_version
run: |
PACKAGE_VERSION=$(cat package.json | jq -r '.version')
echo "packge_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
- run: npm publish --access public --tag beta
if: ${{ contains(steps.check_package_version.outputs.packge_version, 'beta') }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm publish --access public
if: ${{ !contains(steps.check_package_version.outputs.packge_version, 'beta') }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}