chore: try publishing with nx #1
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
name: Publish | |
on: | |
push: | |
branches: | |
# - master | |
# - 'spring*' | |
# - 'summer*' | |
# - 'winter*' | |
jobs: | |
publish: | |
if: "startsWith(github.event.head_commit.message, 'chore: release')" | |
name: Publish | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # needed to create git tag | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.12.2' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Create git tag | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('node:fs') | |
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8')) | |
const { version } = pkg | |
console.log('version', version) | |
# github.rest.git.createRef({ | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# ref: `refs/tags/${version}`, | |
# sha: context.sha | |
# }) | |
- name: Publish packages | |
run: | | |
if [[ "$GIT_BRANCH" == "master" ]; then | |
NPM_DIST_TAG=latest | |
else | |
NPM_DIST_TAG="$GIT_BRANCH" | |
fi | |
npx nx release publish --tag $NPM_DIST_TAG --dry-run | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} |