Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to npm from GitHub actions #12526

Merged
merged 4 commits into from
Dec 22, 2020

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Dec 18, 2020

Q                       A
License MIT

Closes #10663

During GitHub Universe 2020, they presented environments with manual approval for GitHub actions: regardless of who has write access to this repository, we can now granularly configure who has access to a given secret.

I gave access to @JLHwung, @existentialism, @hzoo and me.
Currently the stored NPM_TOKEN is mine, but it it works we should use @babel-bot's.

Now the publishing process is just this 🎉

# Create a new release commit
make new-version

# Push to GitHub
git push --follow-tags

I'm testing this action in the second commit (I'll revert it before merging), publishing an empty package.
This is what the UI looks like: https://drive.google.com/file/d/1q-kCP7rp-7UKZZfChrI3v-s2iVHi0KDE/view

@babel-bot
Copy link
Collaborator

babel-bot commented Dec 18, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/35823/

@nicolo-ribaudo
Copy link
Member Author

This works 🎉 🎉 🎉

Workflow run: https://github.com/babel/babel/actions/runs/430661855
Published package: https://www.npmjs.com/package/@nicolo-ribaudo/babel-publish-test (I released 0.0.1 locally, and 1.0.0 from this action)
GitHub release (if you have write access to the repo): https://github.com/babel/babel/releases/tag/untagged-6839561d8e388548b3b7 - This is completely wrong, but it's just because I didn't push a tag to this PR so the release tool generated the wrong changelog.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 18, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a7bd3ba:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@nicolo-ribaudo nicolo-ribaudo force-pushed the nicolo-ribaudo/publish-from-github-actions branch from b319288 to 03ac1e2 Compare December 18, 2020 18:16
This was meant to be used _now_, but I didn't end up using it
@nicolo-ribaudo nicolo-ribaudo force-pushed the nicolo-ribaudo/publish-from-github-actions branch from fec5242 to 04095c1 Compare December 18, 2020 18:30
@nicolo-ribaudo nicolo-ribaudo temporarily deployed to npm December 18, 2020 18:31 Inactive
This reverts commit 04095c1.
- name: Build and Test
run: make prepublish
- name: Publish to npm
run: yarn release-tool publish --yes
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This line is the only untested step in this PR (I commented it out, run the action, and everything worked). However, we test in in the e2e tests on CircleCI where we publish to verdaccio.

- name: Checkout the new tag
uses: actions/checkout@v2
with:
fetch-depth: 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is fetch depth 0-based or 1-based?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 1-based, 0 means "fetch all". We need it in order to find the previous tag.

@nicolo-ribaudo nicolo-ribaudo merged commit 5b5b548 into main Dec 22, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the nicolo-ribaudo/publish-from-github-actions branch December 22, 2020 23:18
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 24, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: publishing process outdated A closed issue/PR that is archived due to age. Recommended to make a new issue repo automation 🤖
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants