Skip to content

Commit

Permalink
Publish flipper-server to NPM (facebook#3224)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#3224

Automatically publish to https://www.npmjs.com/package/flipper-server

Changelog: [experimental] It is now possible to run a full fledged Flipper as node + browser appication by using `npx flipper-server`

Pull Request resolved: facebook#3224

Test Plan:
https://github.com/facebook/flipper/runs/4659854128?check_suite_focus=true

Checked that the build is non-fb, has no fb plugins etc, and runs from npm

{F690008124}

{F690008123}

{F690008122}

Reviewed By: nikoant

Differential Revision: D33297125

Pulled By: mweststrate

fbshipit-source-id: 505714de01270035895d229684a0f3c721ca5afc
  • Loading branch information
mweststrate authored and facebook-github-bot committed Jan 4, 2022
1 parent b6c884f commit b352584
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 43 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,40 @@ jobs:
with:
filename: .github/action-failure-template.md

build-flipper-server:
needs:
- release
runs-on: ubuntu-latest
env:
desktop-directory: ./desktop

steps:
- uses: actions/checkout@v2
with:
ref: ${{ needs.release.outputs.tag }}
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install
uses: nick-invision/retry@v2.0.0
with:
timeout_minutes: 10
max_attempts: 3
command: cd ${{env.desktop-directory}} && yarn
- name: Build
run: cd ${{env.desktop-directory}} && yarn build:flipper-server
- name: Upload flipper-server
uses: actions/upload-artifact@v1
with:
name: 'flipper-server.tgz'
path: 'dist/flipper-server.zip'

publish:
needs:
- build-win
- build-linux
- build-mac
- build-flipper-server
- release
runs-on: ubuntu-latest

Expand All @@ -176,14 +205,27 @@ jobs:
with:
name: 'Flipper-win.zip'
path: 'Flipper-win.zip'
- name: Download Flipper Server
if: ${{ needs.release.outputs.tag != '' }}
uses: actions/download-artifact@v1
with:
name: 'flipper-server.tgz'
path: 'flipper-server.tgz'
- name: GitHub Upload Release Artifacts
if: ${{ needs.release.outputs.tag != '' }}
uses: passy/github-upload-release-artifacts-action@v2.2.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
created_tag: ${{ needs.release.outputs.tag }}
args: Flipper-mac.dmg/Flipper-mac.dmg Flipper-linux.zip/Flipper-linux.zip Flipper-win.zip/Flipper-win.zip
args: Flipper-mac.dmg/Flipper-mac.dmg Flipper-linux.zip/Flipper-linux.zip Flipper-win.zip/Flipper-win.zip flipper-server.tgz/flipper-server.tgz
- name: Set up npm token
run: echo "//registry.yarnpkg.com/:_authToken=${{ secrets.FLIPPER_NPM_TOKEN }}" >> ~/.npmrc
- name: Publish flipper-server on NPM
run: |
tar zxvf flipper-server.tgz
cd package
yarn publish
- name: Open issue on failure
if: failure()
uses: JasonEtco/create-an-issue@v2.4.0
Expand Down
2 changes: 2 additions & 0 deletions desktop/scripts/build-flipper-server-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ async function modifyPackageManifest(
const manifest = require('../flipper-server/package.json');

manifest.version = versionNumber;
manifest.private = false; // make this package npm-publishable
if (hgRevision != null) {
manifest.revision = hgRevision;
}
Expand Down Expand Up @@ -262,6 +263,7 @@ async function modifyPackageManifest(
if (argv.npx) {
// This is a hack, as npx cached very aggressively if package.version
// didn't change

console.log(`⚙️ Installing flipper-server.tgz using npx`);
await fs.remove(path.join(homedir(), '.npm', '_npx'));
await spawn('npx', [archive, argv.open ? '--open' : '--no-open'], {
Expand Down

0 comments on commit b352584

Please sign in to comment.