try another auth method #25
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 all packages to NPM | |
on: | |
push: | |
branches: | |
- main | |
workflow_call: | |
secrets: | |
NPM_TOKEN: | |
required: true | |
CODEX_BOT_NOTIFY_EDITORJS_PUBLIC_CHAT: | |
required: true | |
env: | |
NOTIFY_WEBHOOK_LINK: ${{ secrets.CODEX_BOT_NOTIFY_EDITORJS_PUBLIC_CHAT }} | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
always-auth: true | |
node-version: 22.1.0 | |
registry-url: 'https://registry.npmjs.org/' | |
- name: Install dependencies | |
run: yarn install | |
- name: Create .npmrc and publish packages | |
run: | | |
echo "npmAuthToken: ${{ secrets.NPM_TOKEN }}" >> .yarnrc.yml | |
yarn publish:ci | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# - name: Create .npmrc and publish packages | |
# run: | | |
# # Create .npmrc file in each package directory | |
# for dir in packages/*; do | |
# if [ -d "$dir" ]; then | |
# echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > "$dir/.npmrc" | |
# fi | |
# done | |
# # Run the publish script | |
# yarn publish:ci | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
notify: | |
needs: publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get package info | |
id: package | |
uses: codex-team/action-nodejs-package-info@v1 | |
- name: Send a message | |
uses: codex-team/action-codexbot-notify@v1 | |
with: | |
webhook: ${{ env.NOTIFY_WEBHOOK_LINK }} | |
message: '📦 [${{ steps.package.outputs.name }}](${{ steps.package.outputs.npmjs-link }}) ${{ steps.package.outputs.version }} was published' | |
parse_mode: 'markdown' | |
disable_web_page_preview: true |