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

Update publish workflow. #554

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
description: Which branch to deploy to peggyjs.org
required: true
options:
- main
Copy link
Member

Choose a reason for hiding this comment

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

If I correctly understand documentation, this creates a choice widget with two values "main" and "stable" when you run workflow from UI or requires parameter with two possible values when you trigger workflow using some tool? It is unclear for me how that inputs will be provided

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The gh-pages workflow might be deleted after we fully switch over. I want to leave it in place for the short term so that I can easily re-publish just the docs if something goes wrong.

The input is provided when you run the gh-pages workflow manually. The Actions section of the GitHub repository provides a mechanism for running the action and for gathering the input from the person requesting the action be run.

- stable

jobs:
Expand All @@ -26,7 +27,7 @@ jobs:
cache: pnpm
- name: Install dependencies
working-directory: docs
run: "pnpm i --frozen-lockfile"
run: "pnpm install"
- name: Build
working-directory: docs
run: "npm run build"
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Package to npmjs
on:
release:
types: [published]
Comment on lines +2 to +4
Copy link
Member

Choose a reason for hiding this comment

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

This will also trigger for draft releases:

A release, pre-release, or draft of a release was published.

Is this what was expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will also trigger for draft releases:

A release, pre-release, or draft of a release was published.

Is this what was expected?

Yes. There are several projects I use that do pre-releases all the way into NPM. npm info eslint versions for an example.

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
Copy link
Member

Choose a reason for hiding this comment

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

Would be good to add comments why this is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

willfix

steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
cache: pnpm
- run: pnpm i -r
- run: npm run build
- run: npm run docs
- run: npm pkg delete devDependencies scripts
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
publish_branch: docs
- run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ browser/
build/
coverage/
docs/_site
docs/js/*-bundle.min.js
docs/vendor/peggy/
examples/*.js
node_modules/
yarn.lock
8 changes: 0 additions & 8 deletions docs/js/benchmark-bundle.min.js

This file was deleted.

8 changes: 0 additions & 8 deletions docs/js/test-bundle.min.js

This file was deleted.

8 changes: 0 additions & 8 deletions docs/vendor/peggy/peggy.min.js

This file was deleted.

Loading