forked from drivenets/design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (92 loc) · 3.38 KB
/
Copy pathrelease.yml
File metadata and controls
115 lines (92 loc) · 3.38 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }} @ ${{ github.ref }}
permissions: {}
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
# if: github.repository_owner == 'drivenets'
permissions:
contents: write # to create release (changesets/action)
issues: write # to post issue comments (changesets/action)
pull-requests: write # to create pull request (changesets/action)
outputs:
should-publish: ${{ steps.changesets.outputs.hasChangesets == 'false' }}
steps:
# changesets/action commits the release PR via git push, so it needs the persisted GITHUB_TOKEN.
- name: Checkout source code # zizmor: ignore[artipacked]
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
filter: 'blob:none'
ssh-key: ${{ secrets.DEPLOY_KEY }}
persist-credentials: true
- name: Install Dependencies
uses: ./.github/actions/install
- name: Create or update release PR
id: changesets
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
with:
commit: 'chore(release): publish'
title: 'chore(release): publish'
build:
name: Build for publish
needs: prepare
if: needs.prepare.outputs.should-publish == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install Dependencies
uses: ./.github/actions/install
- name: Cache turbo
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: .turbo
key: ${{ runner.os }}-turbo-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-build-
- name: Build packages
run: pnpm build
- name: Upload build
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: release-build
path: packages/*/dist
if-no-files-found: error
retention-days: 1
include-hidden-files: false
# WARNING:
# For security reasons, this is the only job that should have `id-token: write` permissions.
# We don't want dependencies and build scripts to have access to this token.
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
permissions:
contents: write # to create release (changesets/action)
id-token: write # for npm trusted publishing
steps:
- name: Checkout source code # zizmor: ignore[artipacked] Need persisted token to push tags.
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install Dependencies
uses: ./.github/actions/install
- name: Download build
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: release-build
path: packages
- name: Publish
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
with:
publish: pnpm changeset publish
env:
NPM_TOKEN: '' # https://github.com/changesets/action/issues/542#issuecomment-3642334398