Skip to content

Commit 227e841

Browse files
authored
[ci] Add workflow to publish releases (facebook#32487)
Adds a new workflow to publish runtime releases from NPM. Note that I commented out the actual publish command so I can test it out first.
1 parent 2df9622 commit 227e841

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: (Runtime) Publish Releases from NPM Manual
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_to_promote:
7+
required: true
8+
description: Current npm version (non-experimental) to promote
9+
type: string
10+
version_to_publish:
11+
required: true
12+
description: Version to publish for the specified packages
13+
type: string
14+
only_packages:
15+
description: Space separated list of packages to publish on NPM. Use this OR skip_packages, not together.
16+
type: string
17+
skip_packages:
18+
description: Space separated list of packages to NOT publish on NPM. Use this OR only_packages, not together.
19+
type: string
20+
tags:
21+
description: Space separated list of tags to tag the release with on NPM
22+
type: string
23+
default: "['untagged']"
24+
dry:
25+
required: true
26+
description: Don't actually publish, just run a dry run
27+
type: boolean
28+
default: true
29+
force_notify:
30+
description: Force a Discord notification
31+
type: boolean
32+
default: false
33+
34+
env:
35+
TZ: /usr/share/zoneinfo/America/Los_Angeles
36+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
37+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
38+
GH_TOKEN: ${{ github.token }}
39+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
41+
jobs:
42+
notify:
43+
if: ${{ inputs.force_notify || inputs.dry == false || inputs.dry == 'false' }}
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Discord Webhook Action
47+
uses: tsickert/[email protected]
48+
with:
49+
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
50+
embed-author-name: ${{ github.event.sender.login }}
51+
embed-author-url: ${{ github.event.sender.html_url }}
52+
embed-author-icon-url: ${{ github.event.sender.avatar_url }}
53+
embed-title: '⚠️ Publishing release from NPM'
54+
embed-description: |
55+
```
56+
inputs: ${{ toJson(inputs) }}
57+
```
58+
embed-url: https://github.com/facebook/react/actions/runs/${{ github.run_id }}
59+
60+
publish:
61+
name: Publish releases
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v4
65+
- uses: actions/setup-node@v4
66+
with:
67+
node-version-file: '.nvmrc'
68+
cache: yarn
69+
cache-dependency-path: yarn.lock
70+
- name: Restore cached node_modules
71+
uses: actions/cache@v4
72+
id: node_modules
73+
with:
74+
path: "**/node_modules"
75+
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
76+
- name: Ensure clean build directory
77+
run: rm -rf build
78+
- run: yarn install --frozen-lockfile
79+
- run: yarn install --frozen-lockfile
80+
working-directory: scripts/release
81+
- run: cp ./scripts/release/ci-npmrc ~/.npmrc
82+
- if: '${{ inputs.only_packages }}'
83+
run: |
84+
scripts/release/prepare-release-from-npm.js --skipTests --version=${{ inputs.version_to_promote }} --onlyPackages=${{ inputs.only_packages }}
85+
ls -R build/node_modules
86+
# scripts/release/publish.js --ci --tags=${{ inputs.tags }} --publishVersion=${{ inputs.version_to_publish }} --onlyPackages=${{ inputs.only_packages }} --dry=${{ inputs.dry || 'false' }}
87+
- if: '${{ inputs.skip_packages }}'
88+
run: |
89+
scripts/release/prepare-release-from-npm.js --skipTests --version=${{ inputs.version_to_promote }} --skipPackages=${{ inputs.skip_packages }}
90+
ls -R build/node_modules
91+
# scripts/release/publish.js --ci --tags=${{ inputs.tags }} --publishVersion=${{ inputs.version_to_publish }} --skipPackages=${{ inputs.skip_packages }} --dry=${{ inputs.dry || 'false' }}

0 commit comments

Comments
 (0)