Skip to content

ci: publish when cache #28

ci: publish when cache

ci: publish when cache #28

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
- feat_sync
jobs:
build:
runs-on: ubuntu-latest
environment: Production
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Get yarn cache directory
id: yarn-cache-dir
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Debug NPM_TOKEN
run: |
echo "NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}"
echo "NPM_TOKEN_EMPTY: ${{ secrets.NPM_TOKEN_EMPTY }}"
- name: Yarn install
run: yarn install
env:
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Run Packages Tests
run: |
# yarn run test skip
- name: Build Packages
run: |
npx lerna exec --scope='@pagenote/*' --no-private --include-dependencies yarn build
env:
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Set Git Identity
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Lerna Version
run: |
npx lerna version --no-push --no-private patch --yes
- name: Create .npmrc
run: echo 'registry=https://registry.npmjs.org' > .npmrc && echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> ~/.npmrc
- name: Publish to NPM
run: |
npx lerna publish from-git --yes --conventional-commits --conventional-graduate
env:
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}