Skip to content

Fix bash for publishing #27

Fix bash for publishing

Fix bash for publishing #27

name: Build, Test, Release
on:
push:
branches: travelperk
pull_request:
branches: "*"
jobs:
build_lint_test:
name: Build, Lint, and Test
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install Pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 8.6.9
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm run lint
- name: Check format
run: pnpm run check-format
- name: Test
run: pnpm run test
- name: Build
run: pnpm run build
release:
name: Release
needs: build_lint_test
permissions:
contents: write # to push release tags
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/travelperk' }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 8.6.9
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Publish to NPM if there is no changeset
shell: bash {0}
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
pnpm run changeset status
if [ $? -eq 1 ]; then
echo "No changeset found, publishing to NPM"
pnpm run release
else
echo "Changeset found, skipping NPM publish"
fi
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}