Skip to content

Commit 16dcad1

Browse files
Merge pull request #1 from ava-cassiopeia/action-definition
Create basic composite action definition
2 parents ac04247 + a3a6419 commit 16dcad1

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

action.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Publish to NPM and GitHub'
2+
description: 'Publishes an NPM package to NPM and GitHub.'
3+
inputs:
4+
npm-package-name:
5+
description: 'The name of the package to publish on NPM.'
6+
required: true
7+
github-package-name:
8+
description: 'The name of the package to publish on GitHub. This must always start with your "@" GitHub username, eg. "@foobar/my-package".'
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up NPM repository
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: '20.x'
17+
registry-url: 'https://registry.npmjs.org'
18+
19+
- name: Set NPM package name
20+
uses: jaywcjlove/github-action-package@v2.0.0
21+
with:
22+
rename: ${{ inputs.npm-package-name }}
23+
24+
- name: Publish to NPM
25+
env:
26+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27+
run: |
28+
npm publish
29+
30+
- name: Set up GitHub repository
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '20.x'
34+
registry-url: 'https://npm.pkg.github.com'
35+
36+
- name: Set GitHub package name
37+
uses: jaywcjlove/github-action-package@v2.0.0
38+
with:
39+
rename: ${{ inputs.github-package-name }}
40+
41+
- name: Publish to GitHub Packages
42+
env:
43+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
run: |
45+
npm publish

0 commit comments

Comments
 (0)