-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (86 loc) · 2.83 KB
/
Copy pathpublish.yml
File metadata and controls
99 lines (86 loc) · 2.83 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Publish
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 1.0.0)'
required: true
type: string
tag:
description: 'NPM tag (latest, beta, next)'
required: true
default: 'latest'
type: choice
options:
- latest
- beta
- next
jobs:
publish:
name: Publish to NPM
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Configure NPM token
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Configure Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Build packages
run: |
cd packages/core
bun run build
cd ../mtcute-adapter
bun run build
- name: Update versions
if: github.event_name == 'workflow_dispatch'
run: |
cd packages/core
npm version ${{ github.event.inputs.version }} --no-git-tag-version
cd ../mtcute-adapter
npm version ${{ github.event.inputs.version }} --no-git-tag-version
- name: Publish core package
run: |
cd packages/core
npm publish --access public --tag ${{ github.event.inputs.tag || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish adapter package
run: |
cd packages/mtcute-adapter
npm publish --access public --tag ${{ github.event.inputs.tag || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
- name: Commit version changes
if: github.event_name == 'workflow_dispatch'
run: |
git add packages/*/package.json
git commit -m "chore: bump version to ${{ github.event.inputs.version }}"
git tag v${{ github.event.inputs.version }}
git push origin main --tags