Compare commits

..

73 Commits

Author SHA1 Message Date
Borales 16098ef84e Updating readme 2022-11-26 23:40:08 +01:00
Oleksandr Bordun 9e77a0618b Merge pull request #56 from Borales/dir
Adding "dir" option
2022-11-26 23:37:02 +01:00
Borales 17af3bf048 Adding "dir" option 2022-11-26 23:35:32 +01:00
Oleksandr Bordun 5841a21eef Merge pull request #55 from Borales/migration
Migration on TS
2022-11-26 23:14:42 +01:00
Borales 4c27ffd69f Cleanup 2022-11-26 23:14:05 +01:00
Borales 0790298b9b Cleanup 2022-11-26 23:13:48 +01:00
Borales d2ca561aa5 Updating cwd 2022-11-26 22:25:09 +01:00
Borales 37ae1f22f9 Bumping actions/upload-artifact ver 2022-11-26 22:02:20 +01:00
Borales 9b8f6b01d0 Publishing dist 2022-11-26 21:59:16 +01:00
Borales 6bc995441e Initial migration on TS 2022-11-26 21:54:41 +01:00
Oleksandr Bordun fdf0082f89 Update CHANGELOG.md 2022-06-08 12:42:31 +02:00
Oleksandr Bordun 1937fedd35 Update README.md 2022-06-08 12:36:52 +02:00
Oleksandr Bordun 9bec063cfa Update README.md 2022-06-08 09:18:58 +02:00
Oleksandr Bordun d8ce577a6f Merge pull request #45 from richard-chim/master
Update python2 to python3 in Dockerfile
2022-06-08 08:49:13 +02:00
Richard Chim 924bcea8f0 Update python2 to python3 in Dockerfile 2022-06-07 23:38:47 -04:00
Oleksandr Bordun 44293a387e Merge pull request #40 from jarvisuser9/patch-1
Fixing a typo in secret name of NPM_AUTH_TOKEN
2021-10-08 14:01:32 +02:00
John Ciprian 1f7c6fbe9c Fixing a typo in secret name of NPM_AUTH_TOKEN 2021-08-06 10:53:27 -04:00
Oleksandr Bordun f6e2aecf62 Merge pull request #38 from tomeksabala/master
Updated readme examples to latest version
2021-06-18 22:13:59 +02:00
Tomasz Sabała 5b0b86cdda Updated readme examples to latest version 2021-06-18 15:00:28 +02:00
Oleksandr Bordun 6207ca676f Update README.md 2020-11-17 20:30:55 +01:00
Oleksandr Bordun 3eab1c9435 Merge pull request #27 from diegocosta/patch-1
Update README.md
2020-06-20 22:10:58 +02:00
Diego Costa f24ed466bd Update README.md
Fixed the syntax for markdown link.
2020-06-20 16:48:58 -03:00
Oleksandr Bordun c33f8306f2 Merge pull request #26 from lucianomlima/patch-1
Update README.md
2020-06-08 17:08:14 +02:00
Luciano Lima 4ac8b9d200 Update README.md
Change checkout action to v2
2020-06-08 11:39:36 -03:00
Oleksandr Bordun 4965e1a0f0 Forcing yarn update 2020-06-05 09:41:55 +02:00
Oleksandr Bordun 2c3d31468d Installing yarn via npm 2020-06-05 09:39:10 +02:00
Oleksandr Bordun 045276f30a Installing latest yarn 2020-06-05 09:33:11 +02:00
Oleksandr Bordun b7482b5362 Merge pull request #18 from thepont/master
Install prerequites for native modules
2019-11-14 08:58:32 +01:00
Paul Esson 729ea4ad03 Update Dockerfile
use build-base for g++ and make
2019-11-13 15:02:21 +11:00
Paul Esson 3a3b5a57de Update Dockerfile
add more requirements for native code compile
2019-11-13 15:00:50 +11:00
Paul Esson fb4aea7299 feat: add python 2 since its a dep of node sass 2019-11-13 14:35:04 +11:00
Oleksandr Bordun 3dce3af319 Update README.md 2019-11-11 18:13:56 +01:00
Oleksandr Bordun 57dd002262 Update CHANGELOG.md 2019-11-08 16:43:41 +01:00
Oleksandr Bordun 1e151b00df Update Dockerfile 2019-11-08 16:43:05 +01:00
Oleksandr Bordun 58112cebd4 Update CHANGELOG.md 2019-11-06 18:00:16 +01:00
Oleksandr Bordun 496d83e0ee Update CHANGELOG.md 2019-11-06 17:59:38 +01:00
Oleksandr Bordun 4d9b2c0dc6 Installing Git 2019-11-06 17:59:03 +01:00
Borales b7233e8545 Updating README 2019-10-21 19:57:29 +02:00
Borales a39c5ddbda Updating README 2019-10-21 19:56:30 +02:00
Oleksandr Bordun 6d5252c0b8 Merge pull request #10 from ardeois/master
fix .npmrc file generation
2019-10-15 20:43:14 +02:00
Corentin Ardeois e0c8d84b6e fix .npmrc file generation
When we pass an `auth-token`, a `.npmrc` file is generated but it's value could be invalid
The parameter substitution to set a default value on `NPM_` was not working.

Github action defines the `NPM_*` environment variables with a null value, but we were setting a default value only if the environment variable was not set at all.
2019-10-15 14:38:37 -04:00
Borales 4e4261c59f Fixing typo 2019-10-14 11:36:20 +02:00
Borales 7214980ec5 Adding icon 2019-10-14 00:29:09 +02:00
Oleksandr Bordun 65448b3ccb Merge pull request #9 from Borales/new-workflow
New workflow
2019-10-14 00:14:39 +02:00
Borales 60b50482c5 Adding publish to docker 2019-10-14 00:12:01 +02:00
Borales 05b6c81cc1 Updating readme 2019-10-14 00:05:38 +02:00
Borales f5b369fc01 Cleanup 2019-10-14 00:00:15 +02:00
Borales 0246406bde Defining npm token and registry 2019-10-13 23:56:24 +02:00
Borales a162e275b0 Updating CHANGELOG and README 2019-10-13 23:46:44 +02:00
Borales 84bafda24c Removing ci.yml 2019-10-13 23:34:45 +02:00
Borales 4e66af0674 Switching to node:10.16-alpine 2019-10-13 23:33:06 +02:00
Borales 3dbac8fd64 Adding initial action.yml 2019-10-13 23:32:40 +02:00
Borales 8148c8b160 Removing test files 2019-10-13 23:32:24 +02:00
Borales bde4840b6f Lint 2019-10-13 23:23:16 +02:00
Borales 9cdb6a613d fixing name 2019-10-13 22:50:36 +02:00
Borales 9907c411e8 Docker lint 2019-10-13 22:48:43 +02:00
Borales ae80f819cc Docker lint 2019-10-13 22:45:19 +02:00
Borales ab1419e4cb Workflow test 2019-10-13 22:43:10 +02:00
Borales 8b95fae89c Adding initial ci.yml workflow 2019-10-13 22:37:02 +02:00
Oleksandr Bordun 7f2a916727 Update CHANGELOG.md 2019-04-22 14:05:55 +02:00
Oleksandr Bordun 5a59b2b2ae Merge pull request #5 from Embraser01/patch-1
Backport some changes from npm actions
2019-04-22 14:01:21 +02:00
Oleksandr Bordun 658f66ff0b Merge branch 'master' into patch-1 2019-04-22 12:19:13 +02:00
Oleksandr Bordun 433d223b19 Fixing Dockerfilelint action 2019-04-22 12:17:11 +02:00
Oleksandr Bordun 7ba8158c63 Update main.workflow 2019-04-22 11:44:37 +02:00
Oleksandr Bordun 02dfec60b1 Updating main workflow 2019-04-22 11:35:55 +02:00
Oleksandr Bordun 05eb7c3a78 Update main.workflow 2019-04-22 01:00:10 +02:00
Oleksandr Bordun 2f417a09c0 Fixing Docker Lint 2019-04-22 00:28:20 +02:00
Oleksandr Bordun 6f4d654ec1 Adding PR tests 2019-04-21 23:42:36 +02:00
Marc-Antoine 097057d996 Use full node image
NPM for Github actions uses the full node image from docker.

I need it because some of my dependencies need python and slim version does not seems to have it.

More here: https://github.com/actions/npm/issues/8
2019-04-21 21:45:04 +02:00
Marc-Antoine ae944a02b7 Backport entrypoint.sh from npm action
I just backported changes made in the NPM action
2019-04-21 21:40:20 +02:00
Oleksandr Bordun ed3b33b7fe Merge pull request #4 from Embraser01/patch-1
Fix action preview (capitalize Borales)
2019-04-21 14:47:33 +02:00
Marc-Antoine a918ccf9e6 Fix action preview (capitalize Borales)
Without it, Github action can't load meta data (icon color, name, etc.)
2019-04-21 11:43:46 +02:00
Oleksandr Bordun e207ae44f5 Updating color 2019-03-09 14:08:35 +01:00
28 changed files with 10386 additions and 192 deletions
-7
View File
@@ -1,7 +0,0 @@
# ignore all files by default
*
# include required files with an exception
!entrypoint.sh
!LICENSE
!README.md
!THIRD_PARTY_NOTICE.md
+4
View File
@@ -0,0 +1,4 @@
dist/
lib/
node_modules/
jest.config.js
+61
View File
@@ -0,0 +1,61 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "no-public" }
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
-49
View File
@@ -1,49 +0,0 @@
workflow "Build and Publish" {
on = "push"
resolves = "Docker Publish"
}
action "Shell Lint" {
uses = "actions/bin/shellcheck@master"
args = "entrypoint.sh"
}
action "Test" {
uses = "actions/bin/bats@master"
args = "test/*.bats"
}
action "Docker Lint" {
uses = "docker://replicated/dockerfilelint"
args = ["Dockerfile"]
}
action "Build" {
needs = ["Shell Lint", "Test", "Docker Lint"]
uses = "actions/docker/cli@master"
args = "build -t yarn ."
}
action "Docker Tag" {
needs = ["Build"]
uses = "actions/docker/tag@master"
args = "yarn borales/yarn --no-latest"
}
action "Publish Filter" {
needs = ["Build"]
uses = "actions/bin/filter@master"
args = "branch master"
}
action "Docker Login" {
needs = ["Publish Filter"]
uses = "actions/docker/login@master"
secrets = ["DOCKER_USERNAME", "DOCKER_PASSWORD"]
}
action "Docker Publish" {
needs = ["Docker Tag", "Docker Login"]
uses = "actions/docker/cli@master"
args = "push borales/yarn"
}
+47
View File
@@ -0,0 +1,47 @@
# https://github.com/actions/typescript-action/blob/main/.github/workflows/check-dist.yml
name: Check dist/
on:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3.5.1
with:
node-version: 16.x
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: |
npm run build
npm run package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
+5
View File
@@ -0,0 +1,5 @@
node_modules
lib
.DS_Store
Thumbs.db
+3
View File
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
+10
View File
@@ -0,0 +1,10 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
}
-2
View File
@@ -1,2 +0,0 @@
brew "bats"
brew "shellcheck"
+30 -1
View File
@@ -1,5 +1,34 @@
# CHANGELOG
### 27 Dec 2018
## 4.1.0 (26 Nov 2022)
- Added `dir` option
## 4.0.0 (26 Nov 2022)
- Migrated to Actions toolkit
## 3.0.0 (8 Jun 2022)
- Migrating to Python3 (thanks to [@richard-chim](https://github.com/richard-chim))
## 2.1.0 (8 Nov 2019)
- Switching to `node:lts` docker image
## 2.0.2 (6 Nov 2019)
- Added Git to the Docker image
## 2.0.0 (14 Oct 2019)
- Migrated to the latest Github Action syntax
- Using `node:10.16-alpine` as base image
## 1.1.0 (22 Apr 2019)
- Docker now uses the full image `node:10` and `entrypoint.sh` accepts extra NPM settings (thanks to [@Embraser01](https://github.com/Embraser01))
## 1.0.0 (27 Dec 2018)
- Added Docker credentials
-16
View File
@@ -1,16 +0,0 @@
FROM node:10-slim
LABEL version="1.0.0"
LABEL repository="https://github.com/Borales/actions-yarn"
LABEL homepage="https://github.com/Borales/actions-yarn"
LABEL maintainer="Oleksandr Bordun <bordun.alexandr@gmail.com>"
LABEL com.github.actions.name="GitHub Action for Yarn"
LABEL com.github.actions.description="Wraps the yarn CLI to enable common yarn commands."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="#2188b6"
# COPY LICENSE README.md THIRD_PARTY_NOTICE.md /
COPY "entrypoint.sh" "/entrypoint.sh"
ENTRYPOINT ["/entrypoint.sh"]
CMD ["help"]
+38 -44
View File
@@ -1,58 +1,52 @@
# GitHub Actions for Yarn
> Look https://github.com/actions/npm for more details.
> Look [github.com/actions/setup-node](https://github.com/actions/setup-node) for more details.
This Action for [yarn](https://yarnpkg.com) enables arbitrary actions with the `yarn` command-line client, including testing packages and publishing to a registry.
## Usage
An example workflow to build, test, and publish an npm package to the default public registry follows:
An example workflow how to install packages via Yarn (using repository syntax):
```hcl
workflow "Build, Test, and Publish" {
on = "push"
resolves = ["Publish"]
}
```yml
name: CI
on: [push]
jobs:
build:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
action "Build" {
uses = "borales/actions-yarn@master"
args = "install"
}
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
action "Test" {
needs = "Build"
uses = "borales/actions-yarn@master"
args = "test"
}
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # if needed
- name: Build production bundle
uses: borales/actions-yarn@v4
with:
cmd: build:prod # will run `yarn build:prod` command
- name: Test the app
uses: borales/actions-yarn@v4
with:
cmd: test # will run `yarn test` command
action "Publish" {
needs = "Test"
uses = "borales/actions-yarn@master"
args = "publish --access public"
secrets = ["NPM_AUTH_TOKEN"]
}
- name: Run test in sub-folder
uses: borales/actions-yarn@v4
with:
cmd: test
dir: 'frontend' # will run `yarn test` in `frontend` sub folder
```
### Secrets
> `cmd` value will be used as a command for Yarn
>
> `dir` value will be used for Yarn `cwd`
* `NPM_AUTH_TOKEN` - **Optional**. The token to use for authentication with the npm registry. Required for `yarn publish` ([more info](https://docs.npmjs.com/getting-started/working_with_tokens))
### Environment variables
* `NPM_REGISTRY_URL` - **Optional**. To specify a registry to authenticate with. Defaults to `registry.npmjs.org`
* `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))
#### Example
To authenticate with, and publish to, a registry other than `registry.npmjs.org`:
```hcl
action "Publish" {
uses = "borales/actions-yarn@master"
args = "publish --access public"
env = {
NPM_REGISTRY_URL = "someOtherRegistry.someDomain.net"
}
secrets = ["NPM_AUTH_TOKEN"]
}
```
More information about [private registry setup](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#use-private-packages).
+17
View File
@@ -0,0 +1,17 @@
name: 'GitHub Action for Yarn'
description: 'Wraps the yarn CLI to enable common yarn commands'
author: 'Alex Bordun'
branding:
icon: 'package'
color: 'blue'
inputs:
cmd:
description: 'Yarn command'
required: true
dir:
description: 'Yarn sub-folder (if needed)'
required: false
default: ''
runs:
using: 'node16'
main: 'dist/index.js'
+4219
View File
File diff suppressed because it is too large Load Diff
+1
View File
File diff suppressed because one or more lines are too long
+97
View File
@@ -0,0 +1,97 @@
@actions/core
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/exec
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/http-client
MIT
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/io
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tunnel
MIT
The MIT License (MIT)
Copyright (c) 2012 Koichi Kobayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
uuid
MIT
The MIT License (MIT)
Copyright (c) 2010-2020 Robert Kieffer and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+1
View File
File diff suppressed because one or more lines are too long
-15
View File
@@ -1,15 +0,0 @@
#!/bin/sh
set -e
if [ -n "$NPM_AUTH_TOKEN" ]; then
# Respect NPM_CONFIG_USERCONFIG if it is provided, default to $HOME/.npmrc
NPM_CONFIG_USERCONFIG="${NPM_CONFIG_USERCONFIG-"$HOME/.npmrc"}"
NPM_REGISTRY_URL="${NPM_REGISTRY_URL-registry.npmjs.org}"
# Allow registry.npmjs.org to be overridden with an environment variable
printf "//%s/:_authToken=%s\\nregistry=%s" "$NPM_REGISTRY_URL" "$NPM_AUTH_TOKEN" "$NPM_REGISTRY_URL" > "$NPM_CONFIG_USERCONFIG"
chmod 0600 "$NPM_CONFIG_USERCONFIG"
fi
sh -c "yarn $*"
+5764
View File
File diff suppressed because it is too large Load Diff
+30
View File
@@ -0,0 +1,30 @@
{
"name": "@borales/actions-yarn",
"version": "4.0.0",
"main": "lib/index.js",
"scripts": {
"build": "tsc",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt",
"test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
},
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2"
},
"devDependencies": {
"@types/node": "^18.11.9",
"@typescript-eslint/parser": "^5.44.0",
"@vercel/ncc": "^0.34.0",
"eslint-plugin-github": "^4.4.1",
"eslint-plugin-jest": "^27.1.6",
"eslint": "^8.28.0",
"jest": "^29.3.1",
"prettier": "^2.8.0",
"typescript": "^4.9.3"
}
}
-15
View File
@@ -1,15 +0,0 @@
#!/bin/sh
# script/bootstrap: Resolve dependencies that the application requires to run.
# Exit if any subcommand fails
set -e
# Ensure we're always running from the project root
cd "$(dirname "$0")/.."
if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
}
fi
-10
View File
@@ -1,10 +0,0 @@
#!/bin/sh
# Exit if any subcommand fails
set -e
# Ensure we're always running from the project root
cd "$(dirname "$0")/.."
bats test/*.bats
shellcheck *.sh
+22
View File
@@ -0,0 +1,22 @@
import {debug, getInput, setFailed, getState} from '@actions/core'
import {ensureYarnIsInstalled} from './yarn'
import {run} from './run'
import {resolve} from 'path'
const main = async () => {
await ensureYarnIsInstalled()
const cmd: string = getInput('cmd', {required: true})
const dir: string = getInput('dir')
const cwd: string = resolve(getState('repositoryPath'), dir || '')
try {
debug(`Running "${cmd}" command`)
await run(cmd, {cwd})
} catch (error) {
if (error instanceof Error) setFailed(error.message)
}
}
main()
+5
View File
@@ -0,0 +1,5 @@
import {exec} from '@actions/exec'
export const run = async (cmd: string, {cwd}: {cwd: string}) => {
await exec('yarn', [cmd], {cwd})
}
+20
View File
@@ -0,0 +1,20 @@
import {debug, setOutput} from '@actions/core'
import {exec, getExecOutput} from '@actions/exec'
import {which} from '@actions/io'
export const ensureYarnIsInstalled = async () => {
try {
await which('yarn', true)
} catch (e) {
await exec('npm install --global yarn')
}
const [{stdout: yarnVersion}, {stdout: nodeVersion}] = await Promise.all([
getExecOutput('yarn', ['--version'], {silent: true}),
getExecOutput('node', ['--version'], {silent: true})
])
debug(`Node ${nodeVersion.trim()} detected`)
debug(`Yarn v${yarnVersion.trim()} detected`)
setOutput('yarn-version', yarnVersion.trim())
}
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
echo "Fake yarn"
-31
View File
@@ -1,31 +0,0 @@
#!/usr/bin/env bats
PATH="$PATH:$BATS_TEST_DIRNAME/bin"
function setup() {
# Ensure GITHUB_WORKSPACE is set
export GITHUB_WORKSPACE="${GITHUB_WORKSPACE-"${BATS_TEST_DIRNAME}/.."}"
}
@test "entrypoint runs successfully" {
run $GITHUB_WORKSPACE/entrypoint.sh help
echo "$output"
[ "$status" -eq 0 ]
}
@test "npmrc location can be overridden" {
export NPM_CONFIG_USERCONFIG=$( mktemp )
export NPM_AUTH_TOKEN=NPM_AUTH_TOKEN
run $GITHUB_WORKSPACE/entrypoint.sh help
[ "$status" -eq 0 ]
[ "$(cat $NPM_CONFIG_USERCONFIG)" = $'//registry.npmjs.org/:_authToken=NPM_AUTH_TOKEN\nregistry=registry.npmjs.org' ]
}
@test "registry can be overridden" {
export NPM_CONFIG_USERCONFIG=$( mktemp )
export NPM_REGISTRY_URL=someOtherRegistry.someDomain.net
export NPM_AUTH_TOKEN=NPM_AUTH_TOKEN
run $GITHUB_WORKSPACE/entrypoint.sh help
[ "$status" -eq 0 ]
[ "$(cat $NPM_CONFIG_USERCONFIG)" = $'//someOtherRegistry.someDomain.net/:_authToken=NPM_AUTH_TOKEN\nregistry=someOtherRegistry.someDomain.net' ]
}
+12
View File
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"outDir": "./lib" /* Redirect output structure to the directory. */,
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
"strict": true /* Enable all strict type-checking options. */,
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
},
"exclude": ["node_modules", "**/*.test.ts"]
}