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

Add CI auto-build #21

Closed
wants to merge 5 commits into from
Closed

Add CI auto-build #21

wants to merge 5 commits into from

Conversation

paulmillr
Copy link

@paulmillr paulmillr commented Jul 22, 2024

Add CI auto-build:

Lock CI action commits:

  • Prevents supply chain attacks when git tag is replaced with another commit

Compared to 0.1.5, it's now 19x smaller:

  • age-0.1.5.js: 1.46MB
    • minified: 963.3KB
    • minified + gzipped: 299.74KB
  • age-noble.js: 77.73KB
    • minified: 38.5KB
    • minified + gzipped: 13.93KB

@FiloSottile
Copy link
Owner

Thank you! No need to lock the versions in the test Actions, they have

permissions:
  contents: read

and I set the default to read-only, too.

image

About the esbuild release artifact, can you help me understand what/how downstream users use it? The README has an example for creating a file that sets a global variable. This instead would be an ES module, right? It's for use as a <script type="module">?

@paulmillr
Copy link
Author

The end-result would look like one in here: https://github.com/paulmillr/noble-curves/releases/tag/1.4.2

It has global variable "age".

Which means it would be for plain classic <script src="..."></script>, not script type module. But it could probably be used with modules as well.

@paulmillr
Copy link
Author

paulmillr commented Jul 22, 2024

I also usually do NPM publish using CI: publish-npm.yml

It will build the package and upload it to NPM, using transparency logs. This would require adding NPM_PUBLISH_TOKEN to the repository.

It allows to keep one less token which can be stolen from my machine.

FiloSottile added a commit that referenced this pull request Jul 23, 2024
FiloSottile added a commit that referenced this pull request Jul 23, 2024
Based on a suggestion by @paulmillr.

Closes #21
@FiloSottile
Copy link
Owner

Thank you! I went for something similar (I do this a lot) based on your PR. Main differences are using two build stages to drop privileges in the one that runs esbuild (and to always upload an artifact for debugging and to notice breakages even if it's not a release), and avoiding the separate package.json.

Opening an issue for NPM publishing, I would definitely like not to have this bearer token sitting around.

@FiloSottile FiloSottile mentioned this pull request Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants