Skip to content

Commit c362436

Browse files
author
Theomegas1
authored
Create npm-publish-github-packages.yml
github workflow Signed-off-by: Theomegas1 <[email protected]>
1 parent 280df59 commit c362436

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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@v3
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: 16
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@v3
29+
- uses: actions/setup-node@v3
30+
with:
31+
node-version: 16
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+
- name: Setup Node.js environment
38+
uses: actions/[email protected]
39+
with:
40+
# Set always-auth in npmrc.
41+
always-auth: # optional, default is false
42+
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.
43+
node-version: # optional
44+
# File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions.
45+
node-version-file: # optional
46+
# Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.
47+
architecture: # optional
48+
# Set this option if you want the action to check for the latest available version that satisfies the version spec.
49+
check-latest: # optional
50+
# Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.
51+
registry-url: # optional
52+
# Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).
53+
scope: # optional
54+
# Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
55+
token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }}
56+
# Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.
57+
cache: # optional
58+
# Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.
59+
cache-dependency-path: # optional

0 commit comments

Comments
 (0)