Skip to content

Commit 94e6933

Browse files
GitHubswintonNick Van Wiggerenmaxnickvanw
committed
Initial commit
Co-authored-by: Steve Winton <[email protected]> Co-authored-by: Nick Van Wiggeren <[email protected]> Co-authored-by: Steve Winton <[email protected]> Co-authored-by: Max Schoening <[email protected]> Co-authored-by: Nick Van Wiggeren <[email protected]> Co-authored-by: Brandon Keepers <[email protected]> Co-authored-by: Greg Orzell <[email protected]> Co-authored-by: Greg Orzell <[email protected]>
0 parents  commit 94e6933

12 files changed

+1555
-0
lines changed

.dockerignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ignore all files by default
2+
*
3+
# include required files with an exception
4+
!entrypoint.sh
5+
!LICENSE
6+
!README.md
7+
!THIRD_PARTY_NOTICE.md

.github/main.workflow

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
workflow "Build and Publish" {
2+
on = "push"
3+
resolves = "Docker Publish"
4+
}
5+
6+
action "Shell Lint" {
7+
uses = "actions/bin/shellcheck@master"
8+
args = "entrypoint.sh"
9+
}
10+
11+
action "Test" {
12+
uses = "actions/bin/bats@master"
13+
args = "test/*.bats"
14+
}
15+
16+
action "Docker Lint" {
17+
uses = "docker://replicated/dockerfilelint"
18+
args = ["Dockerfile"]
19+
}
20+
21+
action "Build" {
22+
needs = ["Shell Lint", "Test", "Docker Lint"]
23+
uses = "actions/docker/cli@master"
24+
args = "build -t npm ."
25+
}
26+
27+
action "Docker Tag" {
28+
needs = ["Build"]
29+
uses = "actions/docker/tag@master"
30+
args = "npm github/npm --no-latest"
31+
}
32+
33+
action "Publish Filter" {
34+
needs = ["Build"]
35+
uses = "actions/bin/filter@master"
36+
args = "branch master"
37+
}
38+
39+
action "Docker Login" {
40+
needs = ["Publish Filter"]
41+
uses = "actions/docker/login@master"
42+
secrets = ["DOCKER_USERNAME", "DOCKER_PASSWORD"]
43+
}
44+
45+
action "Docker Publish" {
46+
needs = ["Docker Tag", "Docker Login"]
47+
uses = "actions/docker/cli@master"
48+
args = "push github/npm"
49+
}

Brewfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brew "bats"
2+
brew "shellcheck"

Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:10-slim
2+
3+
LABEL version="1.0.0"
4+
LABEL repository="http://github.com/actions/npm"
5+
LABEL homepage="http://github.com/actions/npm"
6+
LABEL maintainer="GitHub Actions <[email protected]>"
7+
8+
LABEL com.github.actions.name="GitHub Action for npm"
9+
LABEL com.github.actions.description="Wraps the npm CLI to enable common npm commands."
10+
LABEL com.github.actions.icon="package"
11+
LABEL com.github.actions.color="red"
12+
COPY LICENSE README.md THIRD_PARTY_NOTICE.md /
13+
14+
COPY "entrypoint.sh" "/entrypoint.sh"
15+
ENTRYPOINT ["/entrypoint.sh"]
16+
CMD ["help"]

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2018 GitHub, Inc. and contributors
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# GitHub Actions for NPM
2+
3+
This Action for [npm](https://www.npmjs.com/) enables arbitrary actions with the `npm` command-line client, including testing packages and publishing to a registry.
4+
5+
## Usage
6+
7+
An example workflow to build, test, and publish an npm package to the default public registry follows:
8+
9+
```hcl
10+
workflow "Build, Test, and Publish" {
11+
on = "push"
12+
resolves = ["Publish"]
13+
}
14+
15+
action "Build" {
16+
uses = "actions/npm@master"
17+
args = "install"
18+
}
19+
20+
action "Test" {
21+
needs = "Build"
22+
uses = "actions/npm@master"
23+
args = "test"
24+
}
25+
26+
action "Publish" {
27+
needs = "Test"
28+
uses = "actions/npm@master"
29+
args = "publish --access public"
30+
secrets = ["NPM_AUTH_TOKEN"]
31+
}
32+
```
33+
34+
### Secrets
35+
36+
* `NPM_AUTH_TOKEN` - **Optional**. The token to use for authentication with the npm registry. Required for `npm publish` ([more info](https://docs.npmjs.com/getting-started/working_with_tokens))
37+
38+
### Environment variables
39+
40+
* `NPM_REGISTRY_URL` - **Optional**. To specify a registry to authenticate with. Defaults to `registry.npmjs.org`
41+
* `NPM_CONFIG_USERCONFIG` - **Optional**. To specify a non-default per-user configuration file. Defaults to `$HOME/.npmrc` ([more info](https://docs.npmjs.com/misc/config#npmrc-files))
42+
43+
#### Example
44+
45+
To authenticate with, and publish to, a registry other than `registry.npmjs.org`:
46+
47+
```hcl
48+
action "Publish" {
49+
uses = "actions/npm@master"
50+
args = "publish --access public"
51+
env = {
52+
NPM_REGISTRY_URL = "someOtherRegistry.someDomain.net"
53+
}
54+
secrets = ["NPM_TOKEN"]
55+
}
56+
```
57+
58+
## License
59+
60+
The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).
61+
62+
Container images built with this project include third party materials. See [THIRD_PARTY_NOTICE.md](THIRD_PARTY_NOTICE.md) for details.

0 commit comments

Comments
 (0)