Repository navigation
102 lines (97 loc) · 3.7 KB
/
Copy pathpublish-prerelease.yaml
File metadata and controls
102 lines (97 loc) · 3.7 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
name: Publish Prerelease Snapshot
on:
workflow_dispatch:
inputs:
ref:
description: Ref to snapshot
required: true
default: main
type: string
concurrency:
group: publish-prerelease-${{ inputs.ref }}
cancel-in-progress: false
env:
HUSKY: "0"
NPM_CONFIG_PROVENANCE: "true"
jobs:
publish-prerelease:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
ref: ${{ inputs.ref }}
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: .tool-versions
cache: pnpm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate publishable package metadata
run: node scripts/release/validate-publishable-packages.mjs
- name: Compute changeset status
run: pnpm exec changeset status --output=.changeset-status.json
- name: Version packages
run: pnpm exec changeset version --snapshot rc
- name: Prepare release manifest
id: manifest
run: node scripts/release/release-manifest.mjs --mode prerelease --status-file .changeset-status.json --output .release-manifest.json
- name: Build publishable packages
if: steps.manifest.outputs.has_packages == 'true'
run: pnpm run build
- name: Publish prerelease packages to npm
if: steps.manifest.outputs.has_packages == 'true'
env:
NODE_AUTH_TOKEN: ""
NPM_TOKEN: ""
run: node scripts/release/publish-release-manifest.mjs --manifest .release-manifest.json --tag rc
- name: Post prerelease to Slack
if: steps.manifest.outputs.has_packages == 'true'
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: C0ABHT0SWA2
text: "🧪 Prerelease snapshots published"
blocks:
- type: "header"
text:
type: "plain_text"
text: "🧪 Prerelease snapshots published"
- type: "section"
text:
type: "mrkdwn"
text: "*Ref:* `${{ inputs.ref }}`\n*Tag:* `rc`\n\n*Packages:*\n${{ steps.manifest.outputs.markdown }}\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
notify-failure:
needs:
- publish-prerelease
if: |
always() &&
needs.publish-prerelease.result == 'failure'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Post to Slack on failure
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: C0ABHT0SWA2
text: "🚨 Prerelease snapshot failed"
blocks:
- type: "header"
text:
type: "plain_text"
text: "🚨 Prerelease snapshot failed"
- type: "section"
text:
type: "mrkdwn"
text: "*Workflow:* `Publish Prerelease Snapshot`\n*Ref:* `${{ inputs.ref }}`\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"