Skip to content

chore: added workflows for auto publishing #9

chore: added workflows for auto publishing

chore: added workflows for auto publishing #9

name: Publish to GitHub Packages
on:
push:
branches:
- main # Change this to your main branch name
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
- run: npm ci
- run: npm test
publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
scope: '@devbabs'
- run: |
# Change publish registry
echo "$(jq '.publishConfig.registry = "https://npm.pkg.github.com"' package.json)" > package.json
# Add organisation scope to package name
echo "$(jq '.name = "@devbabs/react-native-toast-alert"' package.json)" > package.json
# And publish this boy
npm publish --@devbabs:registry=https://npm.pkg.github.com
# - run: npm ci
# - run: npm publish --registry=https://npm.pkg.github.com/@devbabs --access public
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# jobs:
# publish:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '14'
# - name: Install dependencies
# run: npm install
# - name: Publish to GitHub Packages
# run: npm publish --registry=https://npm.pkg.github.com/@devbabs --access public
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}