Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,3 @@ jobs:

- name: Build
run: yarn build

publish:
needs: check-lint-test-build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: 'https://registry.npmjs.org'
scope: '@hawk.so'

- name: Enable Corepack and install dependencies
run: |
corepack enable
corepack prepare yarn@4.5.1 --activate
yarn install

- name: Build
run: yarn build

- name: Publish
run: |
yarn workspace @hawk.so/utils exec npm publish --access public
yarn workspace @hawk.so/github-sdk exec npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- 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: ${{ secrets.CODEX_BOT_WEBHOOK_HAWK }}
message: '📦 [${{ steps.package.outputs.name }}](${{ steps.package.outputs.npmjs-link }}) ${{ steps.package.outputs.version }} was published'
parse_mode: 'markdown'
disable_web_page_preview: true
85 changes: 85 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Publish

on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]

jobs:
publish:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0

- name: Detect changed packages
id: changes
uses: dorny/paths-filter@v3
with:
base: HEAD^
filters: |
utils:
- 'packages/utils/**'
github:
- 'packages/github/**'

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
registry-url: 'https://registry.npmjs.org'
scope: '@hawk.so'

- name: Enable Corepack and install dependencies
run: |
corepack enable
corepack prepare yarn@4.5.1 --activate
yarn install

- name: Build
run: yarn build

- name: Publish
run: |
if [ "${{ steps.changes.outputs.utils }}" == "true" ]; then
yarn workspace @hawk.so/utils exec npm publish --access public
fi
if [ "${{ steps.changes.outputs.github }}" == "true" ]; then
yarn workspace @hawk.so/github-sdk exec npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get published package versions
if: steps.changes.outputs.utils == 'true' || steps.changes.outputs.github == 'true'
id: versions
run: |
if [ "${{ steps.changes.outputs.utils }}" == "true" ]; then
echo "utils_version=$(node -p "require('./packages/utils/package.json').version")" >> $GITHUB_OUTPUT
fi
if [ "${{ steps.changes.outputs.github }}" == "true" ]; then
echo "github_version=$(node -p "require('./packages/github/package.json').version")" >> $GITHUB_OUTPUT
fi

- name: Notify @hawk.so/utils published
if: steps.changes.outputs.utils == 'true'
uses: codex-team/action-codexbot-notify@v1
with:
webhook: ${{ secrets.CODEX_BOT_WEBHOOK_HAWK }}
message: '📦 [@hawk.so/utils](https://www.npmjs.com/package/@hawk.so/utils) ${{ steps.versions.outputs.utils_version }} was published'
parse_mode: 'markdown'
disable_web_page_preview: true

- name: Notify @hawk.so/github-sdk published
if: steps.changes.outputs.github == 'true'
uses: codex-team/action-codexbot-notify@v1
with:
webhook: ${{ secrets.CODEX_BOT_WEBHOOK_HAWK }}
message: '📦 [@hawk.so/github-sdk](https://www.npmjs.com/package/@hawk.so/github-sdk) ${{ steps.versions.outputs.github_version }} was published'
parse_mode: 'markdown'
disable_web_page_preview: true