-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (75 loc) · 2.87 KB
/
publish.yml
File metadata and controls
85 lines (75 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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