Compare commits

..
38 Commits
Author SHA1 Message Date
CrazyMax 7f7463cf16 Fix tsc gen 2019-11-14 23:06:12 +01:00
CrazyMax 8161c37568 Update links 2019-11-14 23:02:23 +01:00
dependabot-preview[bot]andCrazyMax 24dcdbc032 Bump @types/jest from 24.0.22 to 24.0.23 (#36)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 24.0.22 to 24.0.23.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-13 09:21:51 +01:00
CrazyMax 6cf8999416 Update prettier 2019-11-12 00:05:29 +01:00
dependabot-preview[bot]andCrazyMax a07e0f6915 Bump prettier from 1.18.2 to 1.19.1 (#35)
Bumps [prettier](https://github.com/prettier/prettier) from 1.18.2 to 1.19.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/1.18.2...1.19.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-12 00:02:39 +01:00
dependabot-preview[bot]andCrazyMax 038d0bdb06 Bump @types/node from 12.12.6 to 12.12.7 (#34)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.6 to 12.12.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-11 17:46:08 +01:00
dependabot-preview[bot]andCrazyMax 04e91dd608 Bump typescript from 3.6.4 to 3.7.2 (#31)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.6.4 to 3.7.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-07 02:34:33 +01:00
dependabot-preview[bot]andCrazyMax 56fc800a07 Bump @types/jest from 24.0.21 to 24.0.22 (#33)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 24.0.21 to 24.0.22.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-06 10:29:59 +01:00
dependabot-preview[bot]andCrazyMax 3870150cd9 Bump @types/node from 12.12.5 to 12.12.6 (#32)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.5 to 12.12.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-06 10:05:50 +01:00
dependabot-preview[bot]andCrazyMax 67b3825999 Bump @types/node from 12.12.1 to 12.12.5 (#30)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.1 to 12.12.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-05 13:15:07 +01:00
dependabot-preview[bot]andCrazyMax b34502a9bd Bump @types/node from 12.11.7 to 12.12.1 (#28)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.11.7 to 12.12.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-30 23:27:09 +01:00
dependabot-preview[bot]andCrazyMax fbbb9d2933 Bump @types/jest from 24.0.20 to 24.0.21 (#25)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 24.0.20 to 24.0.21.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-30 16:13:51 +01:00
dependabot-preview[bot]andCrazyMax 5c1ffe9e54 Bump @types/jest from 24.0.19 to 24.0.20 (#24)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 24.0.19 to 24.0.20.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-28 11:11:03 +01:00
dependabot-preview[bot]andCrazyMax 2197157725 Bump @types/node from 12.11.6 to 12.11.7 (#23)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.11.6 to 12.11.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-25 15:18:13 +02:00
dependabot-preview[bot]andCrazyMax f8719b9e9e Bump @types/node from 12.11.5 to 12.11.6 (#22)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.11.5 to 12.11.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-24 09:18:11 +02:00
dependabot-preview[bot]andCrazyMax 312dc0926c Bump @types/node from 12.11.2 to 12.11.5 (#20)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.11.2 to 12.11.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-23 16:27:52 +02:00
CrazyMaxandGitHub c35b61573f Update workflows (#21)
* Failed if uncommited changes
* Fix virtual env
* Fix lint workflow
* Display changes
2019-10-23 11:58:41 +02:00
dependabot-preview[bot]andCrazyMax cfb2730919 Bump @types/node from 12.11.1 to 12.11.2 (#19)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.11.1 to 12.11.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-22 09:05:56 +02:00
CrazyMax b6b8efa866 Update node_modules 2019-10-21 10:57:59 +02:00
dependabot-preview[bot]andCrazyMax 12c79eb4d3 Bump @actions/core from 1.1.3 to 1.2.0 (#18)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.1.3 to 1.2.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/master/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-21 10:56:15 +02:00
CrazyMaxandGitHub dbf8569adf Add uncommited workflow (#17) 2019-10-20 05:04:25 +02:00
dependabot-preview[bot]andCrazyMax ad11d1ec00 Bump @types/node from 12.7.12 to 12.11.1 (#16)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.7.12 to 12.11.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-16 15:11:15 +02:00
dependabot-preview[bot]andCrazyMax 83fc827dc9 Bump @types/jest from 24.0.18 to 24.0.19 (#14)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 24.0.18 to 24.0.19.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-16 15:08:42 +02:00
CrazyMax f0b3a037ad Revert "Add workflow to update node_modules on master"
This reverts commit 31483bd47f.
2019-10-16 15:05:16 +02:00
CrazyMax 31483bd47f Add workflow to update node_modules on master 2019-10-16 14:45:51 +02:00
dependabot-preview[bot]andCrazyMax 7dd8c13e52 Bump typescript from 3.6.3 to 3.6.4 (#13)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.6.3 to 3.6.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.6.3...v3.6.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-10 18:58:00 +02:00
CrazyMax f0e3323a5f Release only on tag 2019-10-09 16:34:08 +02:00
dependabot-preview[bot]andCrazyMax 819acba4f6 Bump @types/node from 12.7.11 to 12.7.12
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.7.11 to 12.7.12.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-09 15:28:01 +02:00
CrazyMax fee790ce8c Release only from master 2019-10-09 15:27:06 +02:00
CrazyMax 10d535ff3d Update deps 2019-10-04 18:09:59 +02:00
dependabot-preview[bot]andCrazyMax 0abf5b876c Bump @actions/core from 1.1.1 to 1.1.3
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.1.1 to 1.1.3.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/master/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-04 18:08:04 +02:00
dependabot-preview[bot]andCrazyMax c9d339a3d2 Bump @types/node from 12.7.8 to 12.7.11
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.7.8 to 12.7.11.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-10-04 18:07:53 +02:00
CrazyMaxandCrazyMax a3e2544221 Add release workflow and prepare for v1 2019-10-04 18:05:32 +02:00
Carlos Alexandro BeckerandCrazyMax 1cdd780638 chore: codeowners
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2019-10-03 21:39:01 +02:00
Carlos Alexandro BeckerandCrazyMax f2d5bcb6a1 chore(deps): remove renovate.json
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2019-10-03 21:38:25 +02:00
Renovate BotandCrazyMax 83505d79ed Add renovate.json 2019-10-03 19:47:39 +02:00
CrazyMax c89b56d475 Update README 2019-09-29 02:40:15 +02:00
CrazyMax 34f0b11866 Cleanup 2019-09-28 21:00:35 +02:00
23 changed files with 733 additions and 550 deletions
+1
View File
@@ -0,0 +1 @@
* @crazy-max @caarlos0
+1 -1
View File
@@ -1,2 +1,2 @@
patreon: crazymax github: crazy-max
custom: https://www.paypal.me/crazyws custom: https://www.paypal.me/crazyws
+6 -2
View File
@@ -2,9 +2,13 @@ name: ci
on: on:
pull_request: pull_request:
branches: master branches:
- master
- releases/*
push: push:
branches: master branches:
- master
- releases/*
jobs: jobs:
ci: ci:
+26
View File
@@ -0,0 +1,26 @@
name: lint
on:
pull_request:
paths:
- '.github/workflows/lint.yml'
- 'src/*'
jobs:
lint:
runs-on: ubuntu-latest
steps:
-
# https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v1
-
# https://github.com/actions/setup-node
name: Set up Node
uses: actions/setup-node@v1
-
name: Setup TS
run: npm install tslint typescript -g
-
name: Lint check
run: tslint './src/*.ts'
+73
View File
@@ -0,0 +1,73 @@
name: release
on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
jobs:
release:
runs-on: ubuntu-latest
steps:
-
# https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v1
-
name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
MINOR=${TAG%.*}
MAJOR=${MINOR%.*}
echo ::set-output name=tag_name::${TAG}
echo ::set-output name=minor_tag::${MINOR}
echo ::set-output name=major_tag::${MAJOR}
echo ::set-output name=major_exists::$(git show-ref origin/releases/${MAJOR})
-
name: Set up Git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
-
name: Checkout releases/${{ steps.prepare.outputs.major_tag }} branch
run: |
git checkout -B releases/${{ steps.prepare.outputs.major_tag }}
if [ -n "${{ steps.prepare.outputs.major_exists }}" ]; then
git branch --set-upstream-to=origin/releases/${{ steps.prepare.outputs.major_tag }} releases/${{ steps.prepare.outputs.major_tag }}
fi
-
# https://github.com/actions/setup-node
name: Set up Node
uses: actions/setup-node@v1
-
name: NPM production deps
run: |
rm -rf node_modules
sed -i '/node_modules/d' .gitignore
npm install --production
-
name: Commit and push changes
run: |
git add --all
git status --short -uno
git commit -m 'Release ${{ steps.prepare.outputs.tag_name }}'
git show --stat-count=10 HEAD
git push -f origin releases/${{ steps.prepare.outputs.major_tag }}
-
name: Update ${{ steps.prepare.outputs.minor_tag }} tag
run: |
git push origin :refs/tags/${{ steps.prepare.outputs.minor_tag }}
git tag -fa ${{ steps.prepare.outputs.minor_tag }} -m "Release ${{ steps.prepare.outputs.tag_name }}"
git push origin ${{ steps.prepare.outputs.minor_tag }}
-
name: Update ${{ steps.prepare.outputs.major_tag }} tag
run: |
git push origin :refs/tags/${{ steps.prepare.outputs.major_tag }}
git tag -fa ${{ steps.prepare.outputs.major_tag }} -m "Release ${{ steps.prepare.outputs.tag_name }}"
git push origin ${{ steps.prepare.outputs.major_tag }}
+6 -10
View File
@@ -2,9 +2,13 @@ name: test
on: on:
pull_request: pull_request:
branches: master branches:
- master
- releases/*
push: push:
branches: master branches:
- master
- releases/*
jobs: jobs:
test: test:
@@ -23,11 +27,3 @@ jobs:
- -
name: Test name: Test
run: npm run test run: npm run test
-
name: Check for uncommitted changes
# Ensure no changes, but ignore node_modules dir since dev/fresh ci deps installed.
run: |
git diff --exit-code --stat -- . ':!node_modules' \
|| (echo "##[error] found changed files after build. please 'npm run build && npm run format'" \
"and check in all changes" \
&& exit 1)
+33
View File
@@ -0,0 +1,33 @@
name: uncommited
on:
pull_request:
push:
jobs:
changes:
runs-on: ubuntu-latest
steps:
-
# https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v1
-
# https://github.com/actions/setup-node
name: Set up Node
uses: actions/setup-node@v1
-
name: Build
run: |
npm install
npm run build
npm run format
npm prune --production
-
name: Check for uncommitted changes
run: |
if [[ `git status --porcelain` ]]; then
git status --porcelain
echo "##[error] found changed files after build. please 'npm run build && npm run format && npm prune --production'"
exit 1
fi
+10 -10
View File
@@ -1,11 +1,11 @@
{ {
"printWidth": 80, "printWidth": 120,
"tabWidth": 2, "tabWidth": 2,
"useTabs": false, "useTabs": false,
"semi": true, "semi": true,
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"bracketSpacing": false, "bracketSpacing": false,
"arrowParens": "avoid", "arrowParens": "avoid",
"parser": "typescript" "parser": "typescript"
} }
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 897 B

+5 -4
View File
@@ -5,8 +5,9 @@
<p align="center"> <p align="center">
<a href="https://github.com/goreleaser/goreleaser-action/releases/latest"><img alt="GitHub release" src="https://img.shields.io/github/release/goreleaser/goreleaser-action.svg?logo=github&style=flat-square"></a> <a href="https://github.com/goreleaser/goreleaser-action/releases/latest"><img alt="GitHub release" src="https://img.shields.io/github/release/goreleaser/goreleaser-action.svg?logo=github&style=flat-square"></a>
<a href="https://github.com/marketplace/actions/goreleaser-action"><img alt="GitHub marketplace" src="https://img.shields.io/badge/marketplace-goreleaser--action-blue?logo=github&style=flat-square"></a> <a href="https://github.com/marketplace/actions/goreleaser-action"><img alt="GitHub marketplace" src="https://img.shields.io/badge/marketplace-goreleaser--action-blue?logo=github&style=flat-square"></a>
<a href="https://github.com/goreleaser/goreleaser-action/actions"><img alt="Test workflow" src="https://github.com/goreleaser/goreleaser-action/workflows/test/badge.svg"></a> <a href="https://github.com/goreleaser/goreleaser-action/actions?workflow=release"><img alt="Release workflow" src="https://github.com/goreleaser/goreleaser-action/workflows/release/badge.svg"></a>
<a href="https://www.patreon.com/crazymax"><img alt="Support CrazyMax on Patreon" src="https://img.shields.io/badge/crazymax-patreon-f96854.svg?logo=patreon&style=flat-square"></a> <a href="https://github.com/goreleaser/goreleaser-action/actions?workflow=test"><img alt="Test workflow" src="https://github.com/goreleaser/goreleaser-action/workflows/test/badge.svg"></a>
<a href="https://github.com/sponsors/crazy-max"><img src="https://img.shields.io/badge/sponsor-crazy--max-181717.svg?logo=github&style=flat-square" alt="Become a sponsor"></a>
</p> </p>
</p> </p>
@@ -37,7 +38,7 @@ jobs:
uses: actions/setup-go@master uses: actions/setup-go@master
- -
name: Run GoReleaser name: Run GoReleaser
uses: goreleaser/goreleaser-action@master uses: goreleaser/goreleaser-action@v1
with: with:
version: latest version: latest
args: release --rm-dist args: release --rm-dist
@@ -63,7 +64,7 @@ Following inputs can be used as `step.with` keys
If signing is enabled in your GoReleaser configuration, populate the `key` input with your private key If signing is enabled in your GoReleaser configuration, populate the `key` input with your private key
and reference the key in your signing configuration, e.g. and reference the key in your signing configuration, e.g.
``` ```yaml
signs: signs:
- artifacts: checksum - artifacts: checksum
args: ["--batch", "-u", "<key id, fingerprint, email, ...>", "--output", "${signature}", "--detach-sign", "${artifact}"] args: ["--batch", "-u", "<key id, fingerprint, email, ...>", "--output", "${signature}", "--detach-sign", "${artifact}"]
+1 -2
View File
@@ -28,8 +28,7 @@ function run(silent) {
const key = core.getInput('key'); const key = core.getInput('key');
const goreleaser = yield installer.getGoReleaser(version); const goreleaser = yield installer.getGoReleaser(version);
let snapshot = ''; let snapshot = '';
if (!process.env.GITHUB_REF || if (!process.env.GITHUB_REF || !process.env.GITHUB_REF.startsWith('refs/tags/')) {
!process.env.GITHUB_REF.startsWith('refs/tags/')) {
console.log(`⚠️ No tag found. Snapshot forced`); console.log(`⚠️ No tag found. Snapshot forced`);
if (!args.includes('--snapshot')) { if (!args.includes('--snapshot')) {
snapshot = ' --snapshot'; snapshot = ' --snapshot';
+139 -96
View File
@@ -1,97 +1,140 @@
# `@actions/core` # `@actions/core`
> Core functions for setting results, logging, registering secrets and exporting variables across actions > Core functions for setting results, logging, registering secrets and exporting variables across actions
## Usage ## Usage
#### Inputs/Outputs ### Import the package
You can use this library to get inputs or set outputs: ```js
// javascript
```js const core = require('@actions/core');
const core = require('@actions/core');
// typescript
const myInput = core.getInput('inputName', { required: true }); import * as core from '@actions/core';
```
// Do stuff
#### Inputs/Outputs
core.setOutput('outputKey', 'outputVal');
``` Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
#### Exporting variables ```js
const myInput = core.getInput('inputName', { required: true });
You can also export variables for future steps. Variables get set in the environment.
core.setOutput('outputKey', 'outputVal');
```js ```
const core = require('@actions/core');
#### Exporting variables
// Do stuff
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
core.exportVariable('envVar', 'Val');
``` ```js
core.exportVariable('envVar', 'Val');
#### PATH Manipulation ```
You can explicitly add items to the path for all remaining steps in a workflow: #### Setting a secret
```js Setting a secret registers the secret with the runner to ensure it is masked in logs.
const core = require('@actions/core');
```js
core.addPath('pathToTool'); core.setSecret('myPassword');
``` ```
#### Exit codes #### PATH Manipulation
You should use this library to set the failing exit code for your action: To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
```js ```js
const core = require('@actions/core'); core.addPath('/path/to/mytool');
```
try {
// Do stuff #### Exit codes
}
catch (err) { You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
// setFailed logs the message and sets a failing exit code
core.setFailed(`Action failed with error ${err}`); ```js
} const core = require('@actions/core');
``` try {
// Do stuff
#### Logging }
catch (err) {
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs). // setFailed logs the message and sets a failing exit code
core.setFailed(`Action failed with error ${err}`);
```js }
const core = require('@actions/core');
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
const myInput = core.getInput('input');
try { ```
core.debug('Inside try block');
#### Logging
if (!myInput) {
core.warning('myInput was not set'); Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
}
```js
// Do stuff const core = require('@actions/core');
}
catch (err) { const myInput = core.getInput('input');
core.error(`Error ${err}, action may still succeed though`); try {
} core.debug('Inside try block');
```
if (!myInput) {
This library can also wrap chunks of output in foldable groups. core.warning('myInput was not set');
}
```js
const core = require('@actions/core') // Do stuff
}
// Manually wrap output catch (err) {
core.startGroup('Do some function') core.error(`Error ${err}, action may still succeed though`);
doSomeFunction() }
core.endGroup() ```
// Wrap an asynchronous function call This library can also wrap chunks of output in foldable groups.
const result = await core.group('Do something async', async () => {
const response = await doSomeHTTPRequest() ```js
return response const core = require('@actions/core')
})
// Manually wrap output
core.startGroup('Do some function')
doSomeFunction()
core.endGroup()
// Wrap an asynchronous function call
const result = await core.group('Do something async', async () => {
const response = await doSomeHTTPRequest()
return response
})
```
#### Action state
You can use this library to save state and get state for sharing information between a given wrapper action:
**action.yml**
```yaml
name: 'Wrapper action sample'
inputs:
name:
default: 'GitHub'
runs:
using: 'node12'
main: 'main.js'
post: 'cleanup.js'
```
In action's `main.js`:
```js
const core = require('@actions/core');
core.saveState("pidToKill", 12345);
```
In action's `cleanup.js`:
```js
const core = require('@actions/core');
var pid = core.getState("pidToKill");
process.kill(pid);
``` ```
+16 -16
View File
@@ -1,16 +1,16 @@
interface CommandProperties { interface CommandProperties {
[key: string]: string; [key: string]: string;
} }
/** /**
* Commands * Commands
* *
* Command Format: * Command Format:
* ##[name key=value;key=value]message * ##[name key=value;key=value]message
* *
* Examples: * Examples:
* ##[warning]This is the user warning message * ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definitelyNotAPassword! * ##[set-secret name=mypassword]definitelyNotAPassword!
*/ */
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void; export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
export declare function issue(name: string, message?: string): void; export declare function issue(name: string, message?: string): void;
export {}; export {};
+65 -65
View File
@@ -1,66 +1,66 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const os = require("os"); const os = require("os");
/** /**
* Commands * Commands
* *
* Command Format: * Command Format:
* ##[name key=value;key=value]message * ##[name key=value;key=value]message
* *
* Examples: * Examples:
* ##[warning]This is the user warning message * ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definitelyNotAPassword! * ##[set-secret name=mypassword]definitelyNotAPassword!
*/ */
function issueCommand(command, properties, message) { function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message); const cmd = new Command(command, properties, message);
process.stdout.write(cmd.toString() + os.EOL); process.stdout.write(cmd.toString() + os.EOL);
} }
exports.issueCommand = issueCommand; exports.issueCommand = issueCommand;
function issue(name, message = '') { function issue(name, message = '') {
issueCommand(name, {}, message); issueCommand(name, {}, message);
} }
exports.issue = issue; exports.issue = issue;
const CMD_STRING = '::'; const CMD_STRING = '::';
class Command { class Command {
constructor(command, properties, message) { constructor(command, properties, message) {
if (!command) { if (!command) {
command = 'missing.command'; command = 'missing.command';
} }
this.command = command; this.command = command;
this.properties = properties; this.properties = properties;
this.message = message; this.message = message;
} }
toString() { toString() {
let cmdStr = CMD_STRING + this.command; let cmdStr = CMD_STRING + this.command;
if (this.properties && Object.keys(this.properties).length > 0) { if (this.properties && Object.keys(this.properties).length > 0) {
cmdStr += ' '; cmdStr += ' ';
for (const key in this.properties) { for (const key in this.properties) {
if (this.properties.hasOwnProperty(key)) { if (this.properties.hasOwnProperty(key)) {
const val = this.properties[key]; const val = this.properties[key];
if (val) { if (val) {
// safely append the val - avoid blowing up when attempting to // safely append the val - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason // call .replace() if message is not a string for some reason
cmdStr += `${key}=${escape(`${val || ''}`)},`; cmdStr += `${key}=${escape(`${val || ''}`)},`;
} }
} }
} }
} }
cmdStr += CMD_STRING; cmdStr += CMD_STRING;
// safely append the message - avoid blowing up when attempting to // safely append the message - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason // call .replace() if message is not a string for some reason
const message = `${this.message || ''}`; const message = `${this.message || ''}`;
cmdStr += escapeData(message); cmdStr += escapeData(message);
return cmdStr; return cmdStr;
} }
} }
function escapeData(s) { function escapeData(s) {
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A'); return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
} }
function escape(s) { function escape(s) {
return s return s
.replace(/\r/g, '%0D') .replace(/\r/g, '%0D')
.replace(/\n/g, '%0A') .replace(/\n/g, '%0A')
.replace(/]/g, '%5D') .replace(/]/g, '%5D')
.replace(/;/g, '%3B'); .replace(/;/g, '%3B');
} }
//# sourceMappingURL=command.js.map //# sourceMappingURL=command.js.map
+112 -99
View File
@@ -1,99 +1,112 @@
/** /**
* Interface for getInput options * Interface for getInput options
*/ */
export interface InputOptions { export interface InputOptions {
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */ /** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
required?: boolean; required?: boolean;
} }
/** /**
* The code to exit an action * The code to exit an action
*/ */
export declare enum ExitCode { export declare enum ExitCode {
/** /**
* A code indicating that the action was successful * A code indicating that the action was successful
*/ */
Success = 0, Success = 0,
/** /**
* A code indicating that the action was a failure * A code indicating that the action was a failure
*/ */
Failure = 1 Failure = 1
} }
/** /**
* sets env variable for this action and future actions in the job * Sets env variable for this action and future actions in the job
* @param name the name of the variable to set * @param name the name of the variable to set
* @param val the value of the variable * @param val the value of the variable
*/ */
export declare function exportVariable(name: string, val: string): void; export declare function exportVariable(name: string, val: string): void;
/** /**
* exports the variable and registers a secret which will get masked from logs * Registers a secret which will get masked from logs
* @param name the name of the variable to set * @param secret value of the secret
* @param val value of the secret */
*/ export declare function setSecret(secret: string): void;
export declare function exportSecret(name: string, val: string): void; /**
/** * Prepends inputPath to the PATH (for this action and future actions)
* Prepends inputPath to the PATH (for this action and future actions) * @param inputPath
* @param inputPath */
*/ export declare function addPath(inputPath: string): void;
export declare function addPath(inputPath: string): void; /**
/** * Gets the value of an input. The value is also trimmed.
* Gets the value of an input. The value is also trimmed. *
* * @param name name of the input to get
* @param name name of the input to get * @param options optional. See InputOptions.
* @param options optional. See InputOptions. * @returns string
* @returns string */
*/ export declare function getInput(name: string, options?: InputOptions): string;
export declare function getInput(name: string, options?: InputOptions): string; /**
/** * Sets the value of an output.
* Sets the value of an output. *
* * @param name name of the output to set
* @param name name of the output to set * @param value value to store
* @param value value to store */
*/ export declare function setOutput(name: string, value: string): void;
export declare function setOutput(name: string, value: string): void; /**
/** * Sets the action status to failed.
* Sets the action status to failed. * When the action exits it will be with an exit code of 1
* When the action exits it will be with an exit code of 1 * @param message add error issue message
* @param message add error issue message */
*/ export declare function setFailed(message: string): void;
export declare function setFailed(message: string): void; /**
/** * Writes debug message to user log
* Writes debug message to user log * @param message debug message
* @param message debug message */
*/ export declare function debug(message: string): void;
export declare function debug(message: string): void; /**
/** * Adds an error issue
* Adds an error issue * @param message error issue message
* @param message error issue message */
*/ export declare function error(message: string): void;
export declare function error(message: string): void; /**
/** * Adds an warning issue
* Adds an warning issue * @param message warning issue message
* @param message warning issue message */
*/ export declare function warning(message: string): void;
export declare function warning(message: string): void; /**
/** * Writes info to log with console.log.
* Writes info to log with console.log. * @param message info message
* @param message info message */
*/ export declare function info(message: string): void;
export declare function info(message: string): void; /**
/** * Begin an output group.
* Begin an output group. *
* * Output until the next `groupEnd` will be foldable in this group
* Output until the next `groupEnd` will be foldable in this group *
* * @param name The name of the output group
* @param name The name of the output group */
*/ export declare function startGroup(name: string): void;
export declare function startGroup(name: string): void; /**
/** * End an output group.
* End an output group. */
*/ export declare function endGroup(): void;
export declare function endGroup(): void; /**
/** * Wrap an asynchronous function call in a group.
* Wrap an asynchronous function call in a group. *
* * Returns the same type as the function itself.
* Returns the same type as the function itself. *
* * @param name The name of the group
* @param name The name of the group * @param fn The function to wrap in the group
* @param fn The function to wrap in the group */
*/ export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>; /**
* Saves state for current action, the state can only be retrieved by this action's post job execution.
*
* @param name name of the state to store
* @param value value to store
*/
export declare function saveState(name: string, value: string): void;
/**
* Gets the value of an state set by this action's main execution.
*
* @param name name of the state to get
* @returns string
*/
export declare function getState(name: string): string;
+194 -176
View File
@@ -1,177 +1,195 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("./command"); const command_1 = require("./command");
const os = require("os"); const os = require("os");
const path = require("path"); const path = require("path");
/** /**
* The code to exit an action * The code to exit an action
*/ */
var ExitCode; var ExitCode;
(function (ExitCode) { (function (ExitCode) {
/** /**
* A code indicating that the action was successful * A code indicating that the action was successful
*/ */
ExitCode[ExitCode["Success"] = 0] = "Success"; ExitCode[ExitCode["Success"] = 0] = "Success";
/** /**
* A code indicating that the action was a failure * A code indicating that the action was a failure
*/ */
ExitCode[ExitCode["Failure"] = 1] = "Failure"; ExitCode[ExitCode["Failure"] = 1] = "Failure";
})(ExitCode = exports.ExitCode || (exports.ExitCode = {})); })(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// Variables // Variables
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/** /**
* sets env variable for this action and future actions in the job * Sets env variable for this action and future actions in the job
* @param name the name of the variable to set * @param name the name of the variable to set
* @param val the value of the variable * @param val the value of the variable
*/ */
function exportVariable(name, val) { function exportVariable(name, val) {
process.env[name] = val; process.env[name] = val;
command_1.issueCommand('set-env', { name }, val); command_1.issueCommand('set-env', { name }, val);
} }
exports.exportVariable = exportVariable; exports.exportVariable = exportVariable;
/** /**
* exports the variable and registers a secret which will get masked from logs * Registers a secret which will get masked from logs
* @param name the name of the variable to set * @param secret value of the secret
* @param val value of the secret */
*/ function setSecret(secret) {
function exportSecret(name, val) { command_1.issueCommand('add-mask', {}, secret);
exportVariable(name, val); }
// the runner will error with not implemented exports.setSecret = setSecret;
// leaving the function but raising the error earlier /**
command_1.issueCommand('set-secret', {}, val); * Prepends inputPath to the PATH (for this action and future actions)
throw new Error('Not implemented.'); * @param inputPath
} */
exports.exportSecret = exportSecret; function addPath(inputPath) {
/** command_1.issueCommand('add-path', {}, inputPath);
* Prepends inputPath to the PATH (for this action and future actions) process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
* @param inputPath }
*/ exports.addPath = addPath;
function addPath(inputPath) { /**
command_1.issueCommand('add-path', {}, inputPath); * Gets the value of an input. The value is also trimmed.
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; *
} * @param name name of the input to get
exports.addPath = addPath; * @param options optional. See InputOptions.
/** * @returns string
* Gets the value of an input. The value is also trimmed. */
* function getInput(name, options) {
* @param name name of the input to get const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
* @param options optional. See InputOptions. if (options && options.required && !val) {
* @returns string throw new Error(`Input required and not supplied: ${name}`);
*/ }
function getInput(name, options) { return val.trim();
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; }
if (options && options.required && !val) { exports.getInput = getInput;
throw new Error(`Input required and not supplied: ${name}`); /**
} * Sets the value of an output.
return val.trim(); *
} * @param name name of the output to set
exports.getInput = getInput; * @param value value to store
/** */
* Sets the value of an output. function setOutput(name, value) {
* command_1.issueCommand('set-output', { name }, value);
* @param name name of the output to set }
* @param value value to store exports.setOutput = setOutput;
*/ //-----------------------------------------------------------------------
function setOutput(name, value) { // Results
command_1.issueCommand('set-output', { name }, value); //-----------------------------------------------------------------------
} /**
exports.setOutput = setOutput; * Sets the action status to failed.
//----------------------------------------------------------------------- * When the action exits it will be with an exit code of 1
// Results * @param message add error issue message
//----------------------------------------------------------------------- */
/** function setFailed(message) {
* Sets the action status to failed. process.exitCode = ExitCode.Failure;
* When the action exits it will be with an exit code of 1 error(message);
* @param message add error issue message }
*/ exports.setFailed = setFailed;
function setFailed(message) { //-----------------------------------------------------------------------
process.exitCode = ExitCode.Failure; // Logging Commands
error(message); //-----------------------------------------------------------------------
} /**
exports.setFailed = setFailed; * Writes debug message to user log
//----------------------------------------------------------------------- * @param message debug message
// Logging Commands */
//----------------------------------------------------------------------- function debug(message) {
/** command_1.issueCommand('debug', {}, message);
* Writes debug message to user log }
* @param message debug message exports.debug = debug;
*/ /**
function debug(message) { * Adds an error issue
command_1.issueCommand('debug', {}, message); * @param message error issue message
} */
exports.debug = debug; function error(message) {
/** command_1.issue('error', message);
* Adds an error issue }
* @param message error issue message exports.error = error;
*/ /**
function error(message) { * Adds an warning issue
command_1.issue('error', message); * @param message warning issue message
} */
exports.error = error; function warning(message) {
/** command_1.issue('warning', message);
* Adds an warning issue }
* @param message warning issue message exports.warning = warning;
*/ /**
function warning(message) { * Writes info to log with console.log.
command_1.issue('warning', message); * @param message info message
} */
exports.warning = warning; function info(message) {
/** process.stdout.write(message + os.EOL);
* Writes info to log with console.log. }
* @param message info message exports.info = info;
*/ /**
function info(message) { * Begin an output group.
process.stdout.write(message + os.EOL); *
} * Output until the next `groupEnd` will be foldable in this group
exports.info = info; *
/** * @param name The name of the output group
* Begin an output group. */
* function startGroup(name) {
* Output until the next `groupEnd` will be foldable in this group command_1.issue('group', name);
* }
* @param name The name of the output group exports.startGroup = startGroup;
*/ /**
function startGroup(name) { * End an output group.
command_1.issue('group', name); */
} function endGroup() {
exports.startGroup = startGroup; command_1.issue('endgroup');
/** }
* End an output group. exports.endGroup = endGroup;
*/ /**
function endGroup() { * Wrap an asynchronous function call in a group.
command_1.issue('endgroup'); *
} * Returns the same type as the function itself.
exports.endGroup = endGroup; *
/** * @param name The name of the group
* Wrap an asynchronous function call in a group. * @param fn The function to wrap in the group
* */
* Returns the same type as the function itself. function group(name, fn) {
* return __awaiter(this, void 0, void 0, function* () {
* @param name The name of the group startGroup(name);
* @param fn The function to wrap in the group let result;
*/ try {
function group(name, fn) { result = yield fn();
return __awaiter(this, void 0, void 0, function* () { }
startGroup(name); finally {
let result; endGroup();
try { }
result = yield fn(); return result;
} });
finally { }
endGroup(); exports.group = group;
} //-----------------------------------------------------------------------
return result; // Wrapper action state
}); //-----------------------------------------------------------------------
} /**
exports.group = group; * Saves state for current action, the state can only be retrieved by this action's post job execution.
*
* @param name name of the state to store
* @param value value to store
*/
function saveState(name, value) {
command_1.issueCommand('save-state', { name }, value);
}
exports.saveState = saveState;
/**
* Gets the value of an state set by this action's main execution.
*
* @param name name of the state to get
* @returns string
*/
function getState(name) {
return process.env[`STATE_${name}`] || '';
}
exports.getState = getState;
//# sourceMappingURL=core.js.map //# sourceMappingURL=core.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,yBAAwB;AACxB,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW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;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
+14 -13
View File
@@ -1,34 +1,34 @@
{ {
"_args": [ "_args": [
[ [
"@actions/core@1.1.1", "@actions/core@1.2.0",
"X:\\dev\\neard\\www\\github\\ghaction\\ghaction-goreleaser" "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action"
] ]
], ],
"_from": "@actions/core@1.1.1", "_from": "@actions/core@1.2.0",
"_id": "@actions/core@1.1.1", "_id": "@actions/core@1.2.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg==", "_integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==",
"_location": "/@actions/core", "_location": "/@actions/core",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "version",
"registry": true, "registry": true,
"raw": "@actions/core@1.1.1", "raw": "@actions/core@1.2.0",
"name": "@actions/core", "name": "@actions/core",
"escapedName": "@actions%2fcore", "escapedName": "@actions%2fcore",
"scope": "@actions", "scope": "@actions",
"rawSpec": "1.1.1", "rawSpec": "1.2.0",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "1.1.1" "fetchSpec": "1.2.0"
}, },
"_requiredBy": [ "_requiredBy": [
"/", "/",
"/@actions/tool-cache" "/@actions/tool-cache"
], ],
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz", "_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz",
"_spec": "1.1.1", "_spec": "1.2.0",
"_where": "X:\\dev\\neard\\www\\github\\ghaction\\ghaction-goreleaser", "_where": "X:\\dev\\neard\\www\\github\\goreleaser\\goreleaser-action",
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"
}, },
@@ -57,11 +57,12 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/actions/toolkit.git" "url": "git+https://github.com/actions/toolkit.git",
"directory": "packages/core"
}, },
"scripts": { "scripts": {
"test": "echo \"Error: run tests from root\" && exit 1", "test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc" "tsc": "tsc"
}, },
"version": "1.1.1" "version": "1.2.0"
} }
+16 -22
View File
@@ -4,9 +4,9 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.1.1", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz",
"integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg==" "integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw=="
}, },
"@actions/exec": { "@actions/exec": {
"version": "1.0.1", "version": "1.0.1",
@@ -519,24 +519,18 @@
} }
}, },
"@types/jest": { "@types/jest": {
"version": "24.0.18", "version": "24.0.23",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.18.tgz", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.23.tgz",
"integrity": "sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ==", "integrity": "sha512-L7MBvwfNpe7yVPTXLn32df/EK+AMBFAFvZrRuArGs7npEWnlziUXK+5GMIUTI4NIuwok3XibsjXCs5HxviYXjg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/jest-diff": "*" "jest-diff": "^24.3.0"
} }
}, },
"@types/jest-diff": {
"version": "20.0.1",
"resolved": "https://registry.npmjs.org/@types/jest-diff/-/jest-diff-20.0.1.tgz",
"integrity": "sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA==",
"dev": true
},
"@types/node": { "@types/node": {
"version": "12.7.8", "version": "12.12.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.8.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz",
"integrity": "sha512-FMdVn84tJJdV+xe+53sYiZS4R5yn1mAIxfj+DVoNiQjTYz1+OYmjwEZr1ev9nU0axXwda0QDbYl06QHanRVH3A==", "integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w==",
"dev": true "dev": true
}, },
"@types/stack-utils": { "@types/stack-utils": {
@@ -4495,9 +4489,9 @@
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
}, },
"prettier": { "prettier": {
"version": "1.18.2", "version": "1.19.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==", "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
"dev": true "dev": true
}, },
"pretty-format": { "pretty-format": {
@@ -5526,9 +5520,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "3.6.3", "version": "3.7.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.2.tgz",
"integrity": "sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==", "integrity": "sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==",
"dev": true "dev": true
}, },
"typescript-formatter": { "typescript-formatter": {
+5 -5
View File
@@ -24,7 +24,7 @@
"author": "CrazyMax", "author": "CrazyMax",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.1.1", "@actions/core": "^1.2.0",
"@actions/exec": "^1.0.1", "@actions/exec": "^1.0.1",
"@actions/tool-cache": "^1.1.2", "@actions/tool-cache": "^1.1.2",
"download": "^7.1.0", "download": "^7.1.0",
@@ -32,13 +32,13 @@
}, },
"devDependencies": { "devDependencies": {
"@types/download": "^6.2.4", "@types/download": "^6.2.4",
"@types/jest": "^24.0.13", "@types/jest": "^24.0.23",
"@types/node": "^12.7.8", "@types/node": "^12.12.7",
"jest": "^24.8.0", "jest": "^24.8.0",
"jest-circus": "^24.7.1", "jest-circus": "^24.7.1",
"prettier": "^1.17.1", "prettier": "^1.19.1",
"ts-jest": "^24.0.2", "ts-jest": "^24.0.2",
"typescript": "^3.5.1", "typescript": "^3.7.2",
"typescript-formatter": "^7.2.2" "typescript-formatter": "^7.2.2"
} }
} }
+8 -24
View File
@@ -35,23 +35,14 @@ export async function getGoReleaser(version: string): Promise<string> {
extPath = await tc.extractTar(`${tmpdir}/${fileName}`); extPath = await tc.extractTar(`${tmpdir}/${fileName}`);
} }
return path.join( return path.join(extPath, osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser');
extPath,
osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'
);
} }
function getFileName(): string { function getFileName(): string {
const platform: string = const platform: string = osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
osPlat == 'win32' ? 'Windows' : osPlat == 'darwin' ? 'Darwin' : 'Linux';
const arch: string = osArch == 'x64' ? 'x86_64' : 'i386'; const arch: string = osArch == 'x64' ? 'x86_64' : 'i386';
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz'; const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz';
const filename: string = util.format( const filename: string = util.format('goreleaser_%s_%s.%s', platform, arch, ext);
'goreleaser_%s_%s.%s',
platform,
arch,
ext
);
return filename; return filename;
} }
@@ -60,24 +51,17 @@ interface GitHubRelease {
} }
async function determineVersion(version: string): Promise<string> { async function determineVersion(version: string): Promise<string> {
let rest: restm.RestClient = new restm.RestClient( let rest: restm.RestClient = new restm.RestClient('goreleaser-action', 'https://github.com', undefined, {
'goreleaser-action', headers: {
'https://github.com', Accept: 'application/json'
undefined,
{
headers: {
Accept: 'application/json'
}
} }
); });
let res: restm.IRestResponse<GitHubRelease> = await rest.get<GitHubRelease>( let res: restm.IRestResponse<GitHubRelease> = await rest.get<GitHubRelease>(
`/goreleaser/goreleaser/releases/${version}` `/goreleaser/goreleaser/releases/${version}`
); );
if (res.statusCode != 200 || res.result === null) { if (res.statusCode != 200 || res.result === null) {
throw new Error( throw new Error(`Cannot find GoReleaser ${version} release (http ${res.statusCode})`);
`Cannot find GoReleaser ${version} release (http ${res.statusCode})`
);
} }
return res.result.tag_name; return res.result.tag_name;
+1 -4
View File
@@ -11,10 +11,7 @@ export async function run(silent?: boolean) {
const goreleaser = await installer.getGoReleaser(version); const goreleaser = await installer.getGoReleaser(version);
let snapshot = ''; let snapshot = '';
if ( if (!process.env.GITHUB_REF || !process.env.GITHUB_REF.startsWith('refs/tags/')) {
!process.env.GITHUB_REF ||
!process.env.GITHUB_REF.startsWith('refs/tags/')
) {
console.log(`⚠️ No tag found. Snapshot forced`); console.log(`⚠️ No tag found. Snapshot forced`);
if (!args.includes('--snapshot')) { if (!args.includes('--snapshot')) {
snapshot = ' --snapshot'; snapshot = ' --snapshot';