-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (71 loc) · 2.36 KB
/
Copy pathrelease.yml
File metadata and controls
82 lines (71 loc) · 2.36 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
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
# This workflow requires NPM_TOKEN to be set as a repository secret
# To add the secret:
# 1. Go to Settings > Secrets and variables > Actions
# 2. Click "New repository secret"
# 3. Name: NPM_TOKEN
# 4. Value: Your npm access token from https://www.npmjs.com/settings/your-username/tokens
jobs:
release:
name: Release with Changesets
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: 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: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: bun run release
version: bun run version
commit: 'chore: update versions'
title: 'chore: update versions'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build packages before publish
if: steps.changesets.outputs.published == 'true'
run: |
bun run build:core
bun run build:adapter
- name: Publish packages
if: steps.changesets.outputs.published == 'true'
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
cd packages/core && npm publish --access public
cd ../mtcute-adapter && npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const tagName = `v${require('./package.json').version}`;
await github.rest.repos.createRelease({
owner,
repo,
tag_name: tagName,
name: tagName,
draft: false,
prerelease: false,
generate_release_notes: true
});