-
Notifications
You must be signed in to change notification settings - Fork 74
63 lines (54 loc) · 1.89 KB
/
publish.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
name: Publish to NPM
on:
workflow_dispatch:
inputs:
increment:
description: 'Increment "major", "minor", "patch", or "pre*" version; or specify version [default: "patch"]'
required: true
default: 'patch'
type: string
dry-run:
description: 'Do not touch or write anything, but show the commands'
default: true
type: boolean
jobs:
release-it:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Setup
uses: ./.github/actions/setup
- name: Setup NPM auth token
run: |
npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }}
- name: Dry Run Release
if: ${{ inputs.dry-run }}
run: |
yarn release ${{ inputs.increment }} -d --ci
- name: NPM Publish
if: ${{ !inputs.dry-run }}
run: |
git config --global user.email "${{ secrets.GIT_EMAIL }}"
git config --global user.name "${{ secrets.GIT_USERNAME }}"
yarn release ${{ inputs.increment }} --ci --no-git.tag --no-github.release --npm.allowSameVersion
- name: Update Example
if: ${{ !inputs.dry-run }}
id: package-info
run: |
sed "s/\"agora-electron-sdk\": \"\(.*\)\"/\"agora-electron-sdk\": \"${{ inputs.increment }}\"/g" package.json > tmp
mv tmp package.json
working-directory: example
- name: Commit Example
if: ${{ !inputs.dry-run }}
run: |
git add example
git commit -m "chore(example): update example to install agora-electron-sdk@${{ inputs.increment }}"
- name: Release
if: ${{ !inputs.dry-run }}
run: |
yarn release ${{ inputs.increment }} --ci --no-npm --no-git.commit