chore: fix cicd #35
This file contains 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
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@v4 | |
- 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@v4 | |
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@v4 | |
- 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 }} |