-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (78 loc) · 2.31 KB
/
typescript.yml
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
name: TypeScript SDK CI
permissions:
contents: 'write'
on:
push:
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
working-directory: typescript
env:
CI: true
# Enable debug logging for actions
ACTIONS_RUNNER_DEBUG: true
jobs:
Publish:
# run only on 'main' branch
if: github.ref == 'refs/heads/main'
strategy:
matrix:
node_version: ['lts/*']
os: ['ubuntu-latest']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
cache-dependency-path: 'typescript/yarn.lock'
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Bundle & Build
run: yarn build
- name: Publish to npm Registry
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn publish --access public --registry https://registry.npmjs.org
- name: Add Token to .npmrc & Update package.json
working-directory: typescript
run: |
#
# Add token to .npmrc
echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
#
# Update 'github-package-registry' to 'registry' in package.json
sed -i 's/github-package-registry/registry/g' package.json
- name: Publish to GitHub Package Registry
env:
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn publish --access public --registry https://npm.pkg.github.com
# Generate GitHub Release Changelog
Changelog:
# make sure we're on 'main' branch
if: github.ref == 'refs/heads/main'
needs: [Publish]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Generate Changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx changelogithub