Skip to content

Commit c498a9c

Browse files
Create npm-publish-github-packages.yml
1 parent e73a895 commit c498a9c

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
- run: npm ci
19+
- run: npm test
20+
21+
publish-gpr:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
registry-url: https://npm.pkg.github.com/
33+
- run: npm ci
34+
- run: npm publish
35+
env:
36+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
37+
38+
name: Upload a Build Artifact
39+
uses: actions/[email protected]
40+
with:
41+
# Artifact name
42+
name: # optional, default is artifact
43+
# A file, directory or wildcard pattern that describes what to upload
44+
path:
45+
# The desired behavior if no files are found using the provided path.
46+
Available Options:
47+
warn: Output a warning but do not fail the action
48+
error: Fail the action with an error message
49+
ignore: Do not output any warnings or errors, the action does not fail
50+
51+
if-no-files-found: # optional, default is warn
52+
# Duration after which artifact will expire in days. 0 means using default retention.
53+
Minimum 1 day. Maximum 90 days unless changed from the repository settings page.
54+
55+
retention-days: # optional
56+
# The level of compression for Zlib to be applied to the artifact archive. The value can range from 0 to 9: - 0: No compression - 1: Best speed - 6: Default compression (same as GNU Gzip) - 9: Best compression Higher levels will result in better compression, but will take longer to complete. For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads.
57+
58+
compression-level: # optional, default is 6
59+
# If true, an artifact with a matching name will be deleted before a new one is uploaded. If false, the action will fail if an artifact for the given name already exists. Does not fail if the artifact does not exist.
60+
61+
overwrite: # optional, default is false
62+
# If true, hidden files will be included in the artifact. If false, hidden files will be excluded from the artifact.
63+
64+
include-hidden-files: # optional, default is false
65+

0 commit comments

Comments
 (0)