-
Notifications
You must be signed in to change notification settings - Fork 38
77 lines (66 loc) · 2.34 KB
/
changeset-release.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
name: CD
on:
push:
branches:
- main
- dev
env:
NPM_CONFIG_PROVENANCE: true
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
if: github.repository == 'iTwin/iTwinUI'
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.IMJS_ADMIN_GH_TOKEN }}
- uses: pnpm/action-setup@v3
with:
version: 9
- name: Use Node 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- run: pnpm install
- name: Check for existing changesets
id: changesets_files
run: |
changesets=$(pnpm changeset status)
# only true if changesets contains @itwin/itwinui-react or @itwin/itwinui-variables
if [[ $changesets == *"@itwin/itwinui-react"* || $changesets == *"@itwin/itwinui-variables"* ]]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
fi
- name: Check if release PR already exists
id: changesets_branch
run: |
if [[ $(git ls-remote --heads origin refs/heads/changeset-release/main) ]]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
fi
- name: Create or update release PR
if: steps.changesets_branch.outputs.exists == 'true' || steps.changesets_files.outputs.exists == 'true'
uses: changesets/action@v1
with:
version: pnpm changeset version --ignore @itwin/itwinui-css
publish: pnpm release
title: Release packages
commit: Release packages
env:
GITHUB_TOKEN: ${{ secrets.IMJS_ADMIN_GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_PUBLISH_ITWIN }}
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
- name: Publish to npm & GitHub (if not already published)
if: steps.changesets_files.outputs.exists != 'true'
run: |
pnpm release
env:
GITHUB_TOKEN: ${{ secrets.IMJS_ADMIN_GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_ITWIN }}