Compare commits

..
9 Commits
Author SHA1 Message Date
CrazyMaxandGitHub 7550dd0340 Move repository to GoReleaser org (#3) 2019-09-28 20:50:20 +02:00
Gavin CabbageandCrazyMax be0c56834b Artifact signing (#2) 2019-09-26 14:17:18 +02:00
CrazyMaxandGitHub bb450e4e69 Add tests 2019-09-22 07:17:07 +02:00
CrazyMax 79b6548141 Remove cross-env 2019-09-22 00:46:01 +02:00
CrazyMax 88312c23e9 Typo 2019-09-20 23:33:44 +02:00
CrazyMax e92a4fe84e Update README 2019-09-20 23:24:04 +02:00
CrazyMax 9e93a47264 Update workflow 2019-09-20 23:14:11 +02:00
CrazyMax 8c5f3a80d4 Check if already included 2019-09-20 23:11:26 +02:00
CrazyMax c71e1672a2 Snapshot forced if no tag found 2019-09-20 23:08:16 +02:00
39 changed files with 5116 additions and 113 deletions
@@ -1,13 +1,16 @@
name: test
name: ci
on:
pull_request:
branches: master
push:
branches: master
jobs:
test:
ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
@@ -28,4 +31,4 @@ jobs:
uses: ./
with:
version: ${{ matrix.version }}
args: release --snapshot --rm-dist
args: release --skip-publish --rm-dist
+33
View File
@@ -0,0 +1,33 @@
name: test
on:
pull_request:
branches: master
push:
branches: master
jobs:
test:
runs-on: ubuntu-latest
steps:
-
# https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v1
-
name: Install
run: npm ci
-
name: Build
run: npm run build
-
name: 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)
+1
View File
@@ -1,4 +1,5 @@
/.dev
/dist
# Jetbrains
/.idea
+32 -20
View File
@@ -1,18 +1,22 @@
[![GitHub release](https://img.shields.io/github/release/crazy-max/ghaction-goreleaser.svg?style=flat-square)](https://github.com/crazy-max/ghaction-goreleaser/releases/latest)
[![GitHub marketplace](https://img.shields.io/badge/marketplace-goreleaser--action-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/goreleaser-action)
[![Test workflow](https://github.com/crazy-max/ghaction-goreleaser/workflows/test/badge.svg)](https://github.com/crazy-max/ghaction-goreleaser/actions)
[![Support me on Patreon](https://img.shields.io/badge/donate-patreon-f96854.svg?logo=patreon&style=flat-square)](https://www.patreon.com/crazymax)
[![Paypal Donate](https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal&style=flat-square)](https://www.paypal.me/crazyws)
<p align="center">
<img alt="GoReleaser Logo" src="https://avatars2.githubusercontent.com/u/24697112?v=3&s=200" height="140" />
<h3 align="center">GoReleaser Action</h3>
<p align="center"><a href="https://github.com/features/actions">GitHub Action</a> for GoReleaser</p>
<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/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://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>
</p>
</p>
## ✨ About
GitHub Action for [GoReleaser](https://goreleaser.com/), a release automation tool for Go projects.
---
> **:warning: Note:** To use this action, you must have access to the [GitHub Actions](https://github.com/features/actions) feature. GitHub Actions are currently only available in public beta. You can [apply for the GitHub Actions beta here](https://github.com/features/actions/signup/).
## 🚀 Usage
## Usage
Below is a simple snippet to use this action. A [live example](https://github.com/crazy-max/ghaction-goreleaser/actions) is also available for this repository.
Below is a simple snippet to use this action. A [live example](https://github.com/goreleaser/goreleaser-action/actions) is also available for this repository.
```yaml
name: goreleaser
@@ -33,15 +37,18 @@ jobs:
uses: actions/setup-go@master
-
name: Run GoReleaser
uses: crazy-max/ghaction-goreleaser@master
uses: goreleaser/goreleaser-action@master
with:
version: latest
args: release --rm-dist
key: ${{ secrets.YOUR_PRIVATE_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
## 💅 Customizing
## Customizing
### inputs
### Inputs
Following inputs can be used as `step.with` keys
@@ -49,16 +56,21 @@ Following inputs can be used as `step.with` keys
|---------------|---------|-----------|------------------------------------------|
| `version` | String | `latest` | GoReleaser version. Example: `v0.117.0` |
| `args` | String | | Arguments to pass to GoReleaser |
| `key` | String | | Private key to import |
## 🤝 How can I help ?
### Signing
All kinds of contributions are welcome :raised_hands:!<br />
The most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon:<br />
But we're not gonna lie to each other, I'd rather you buy me a beer or two :beers:!
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.
[![Support me on Patreon](.res/patreon.png)](https://www.patreon.com/crazymax)
[![Paypal Donate](.res/paypal.png)](https://www.paypal.me/crazyws)
```
signs:
- artifacts: checksum
args: ["--batch", "-u", "<key id, fingerprint, email, ...>", "--output", "${signature}", "--detach-sign", "${artifact}"]
```
## 📝 License
This feature is currently only compatible when using the default `gpg` command and a private key without a passphrase.
## License
MIT. See `LICENSE` for more details.
+14
View File
@@ -0,0 +1,14 @@
import fs = require('fs');
import * as installer from '../src/installer';
describe('installer', () => {
it('acquires v0.117.0 version of GoReleaser', async () => {
const goreleaser = await installer.getGoReleaser('v0.117.0');
expect(fs.existsSync(goreleaser)).toBe(true);
}, 100000);
it('acquires latest version of GoReleaser', async () => {
const goreleaser = await installer.getGoReleaser('latest');
expect(fs.existsSync(goreleaser)).toBe(true);
}, 100000);
});
+2
View File
@@ -12,6 +12,8 @@ inputs:
default: 'latest'
args:
description: 'Arguments to pass to GoReleaser'
key:
description: 'Private key to import'
runs:
using: 'node12'
+3
View File
@@ -0,0 +1,3 @@
module github.com/goreleaser/goreleaser-action
go 1.12
+11
View File
@@ -0,0 +1,11 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}
+2 -2
View File
@@ -45,7 +45,7 @@ function getGoReleaser(version) {
else {
extPath = yield tc.extractTar(`${tmpdir}/${fileName}`);
}
return path.join(extPath, 'goreleaser');
return path.join(extPath, osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser');
});
}
exports.getGoReleaser = getGoReleaser;
@@ -58,7 +58,7 @@ function getFileName() {
}
function determineVersion(version) {
return __awaiter(this, void 0, void 0, function* () {
let rest = new restm.RestClient('ghaction-goreleaser', 'https://github.com', undefined, {
let rest = new restm.RestClient('goreleaser-action', 'https://github.com', undefined, {
headers: {
Accept: 'application/json'
}
+26 -2
View File
@@ -19,18 +19,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
const installer = __importStar(require("./installer"));
const core = __importStar(require("@actions/core"));
const exec = __importStar(require("@actions/exec"));
function run() {
const fs = __importStar(require("fs"));
function run(silent) {
return __awaiter(this, void 0, void 0, function* () {
try {
const version = core.getInput('version') || 'latest';
const args = core.getInput('args');
const key = core.getInput('key');
const goreleaser = yield installer.getGoReleaser(version);
let snapshot = '';
if (!process.env.GITHUB_REF ||
!process.env.GITHUB_REF.startsWith('refs/tags/')) {
console.log(`⚠️ No tag found. Snapshot forced`);
if (!args.includes('--snapshot')) {
snapshot = ' --snapshot';
}
}
else {
console.log(`${process.env.GITHUB_REF.split('/')[2]} tag found`);
}
if (key) {
console.log('🔑 Importing signing key...');
let path = `${process.env.HOME}/key.asc`;
fs.writeFileSync(path, key, { mode: 0o600 });
yield exec.exec('gpg', ['--import', path], {
silent: silent
});
}
console.log('🏃 Running GoReleaser...');
yield exec.exec(`${goreleaser} ${args}`);
yield exec.exec(`${goreleaser} ${args}${snapshot}`, undefined, {
silent: silent
});
}
catch (error) {
core.setFailed(error.message);
}
});
}
exports.run = run;
run();
-1
View File
@@ -23,7 +23,6 @@
"fetchSpec": "1.0.1"
},
"_requiredBy": [
"#DEV:/",
"/@actions/tool-cache"
],
"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.1.tgz",
-7
View File
@@ -1,7 +0,0 @@
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.
+5 -5
View File
@@ -11,7 +11,7 @@ You can use this to download tools (or other files) from a download URL:
```js
const tc = require('@actions/tool-cache');
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
```
#### Extract
@@ -22,15 +22,15 @@ These can then be extracted in platform specific ways:
const tc = require('@actions/tool-cache');
if (process.platform === 'win32') {
const node12Path = tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
// Or alternately
const node12Path = tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
}
else {
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
}
```
@@ -45,7 +45,7 @@ You'll often want to add it to the path as part of this step:
const tc = require('@actions/tool-cache');
const core = require('@actions/core');
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
+2 -13
View File
@@ -218,12 +218,7 @@ function extractZip(file, dest) {
yield extractZipWin(file, dest);
}
else {
if (process.platform === 'darwin') {
yield extractZipDarwin(file, dest);
}
else {
yield extractZipNix(file, dest);
}
yield extractZipNix(file, dest);
}
return dest;
});
@@ -252,13 +247,7 @@ function extractZipWin(file, dest) {
}
function extractZipNix(file, dest) {
return __awaiter(this, void 0, void 0, function* () {
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
});
}
function extractZipDarwin(file, dest) {
return __awaiter(this, void 0, void 0, function* () {
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip-darwin');
const unzipPath = yield io.which('unzip');
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
});
}
File diff suppressed because one or more lines are too long
+13 -16
View File
@@ -1,36 +1,33 @@
{
"_args": [
[
"@actions/tool-cache@1.1.1",
"X:\\dev\\neard\\www\\github\\ghaction\\ghaction-goreleaser"
]
],
"_from": "@actions/tool-cache@1.1.1",
"_id": "@actions/tool-cache@1.1.1",
"_from": "@actions/tool-cache@1.1.2",
"_id": "@actions/tool-cache@1.1.2",
"_inBundle": false,
"_integrity": "sha512-AILekrrj/L4N/5z5TGtUKVie4nKjxDioCgOEymyYxzPhGfjIxfE71tN2VTTpiICEWJ883rPRj2+WinTr1b6yVA==",
"_integrity": "sha512-IJczPaZr02ECa3Lgws/TJEVco9tjOujiQSZbO3dHuXXjhd5vrUtfOgGwhmz3/f97L910OraPZ8SknofUk6RvOQ==",
"_location": "/@actions/tool-cache",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@actions/tool-cache@1.1.1",
"raw": "@actions/tool-cache@1.1.2",
"name": "@actions/tool-cache",
"escapedName": "@actions%2ftool-cache",
"scope": "@actions",
"rawSpec": "1.1.1",
"rawSpec": "1.1.2",
"saveSpec": null,
"fetchSpec": "1.1.1"
"fetchSpec": "1.1.2"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.1.tgz",
"_spec": "1.1.1",
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.2.tgz",
"_shasum": "304d44cecb9547324731e03ca004a3905e6530d2",
"_spec": "@actions/tool-cache@1.1.2",
"_where": "X:\\dev\\neard\\www\\github\\ghaction\\ghaction-goreleaser",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"bundleDependencies": false,
"dependencies": {
"@actions/core": "^1.1.0",
"@actions/exec": "^1.0.1",
@@ -39,6 +36,7 @@
"typed-rest-client": "^1.4.0",
"uuid": "^3.3.2"
},
"deprecated": false,
"description": "Actions tool-cache lib",
"devDependencies": {
"@types/nock": "^10.0.3",
@@ -54,7 +52,6 @@
"lib",
"scripts"
],
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
"keywords": [
"github",
@@ -75,5 +72,5 @@
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"version": "1.1.1"
"version": "1.1.2"
}
Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -22,7 +22,8 @@
"fetchSpec": "1.0.2"
},
"_requiredBy": [
"/readable-stream"
"/readable-stream",
"/verror"
],
"_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"_spec": "1.0.2",
+2 -1
View File
@@ -22,7 +22,8 @@
"fetchSpec": "0.2.0"
},
"_requiredBy": [
"/query-string"
"/query-string",
"/source-map-resolve"
],
"_resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
"_spec": "0.2.0",
+1
View File
@@ -22,6 +22,7 @@
"fetchSpec": "1.4.1"
},
"_requiredBy": [
"/pump",
"/tar-stream"
],
"_resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
+1
View File
@@ -22,6 +22,7 @@
"fetchSpec": "1.0.5"
},
"_requiredBy": [
"/chalk",
"/strip-outer",
"/trim-repeated"
],
+10 -1
View File
@@ -22,7 +22,16 @@
"fetchSpec": "4.2.2"
},
"_requiredBy": [
"/decompress"
"/@jest/core",
"/@jest/source-map",
"/@jest/transform",
"/decompress",
"/jest-haste-map",
"/jest-runner",
"/jest-runtime",
"/jest-util",
"/load-json-file",
"/write-file-atomic"
],
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz",
"_spec": "4.2.2",
+1
View File
@@ -23,6 +23,7 @@
},
"_requiredBy": [
"/from2",
"/glob",
"/readable-stream"
],
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+2 -1
View File
@@ -24,7 +24,8 @@
"_requiredBy": [
"/decompress-tar",
"/decompress-tarbz2",
"/decompress-targz"
"/decompress-targz",
"/execa"
],
"_resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"_spec": "1.1.0",
+2 -1
View File
@@ -22,7 +22,8 @@
"fetchSpec": "1.0.0"
},
"_requiredBy": [
"/readable-stream"
"/readable-stream",
"/unset-value/has-value/isobject"
],
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"_spec": "1.0.0",
+4 -1
View File
@@ -22,7 +22,10 @@
"fetchSpec": "1.4.0"
},
"_requiredBy": [
"/end-of-stream"
"/end-of-stream",
"/glob",
"/inflight",
"/pump"
],
"_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"_spec": "1.4.0",
+1
View File
@@ -22,6 +22,7 @@
"fetchSpec": "1.0.0"
},
"_requiredBy": [
"/execa",
"/p-timeout"
],
"_resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+3 -1
View File
@@ -24,8 +24,10 @@
"_requiredBy": [
"/download",
"/got",
"/load-json-file",
"/make-dir",
"/npm-conf"
"/npm-conf",
"/path-type"
],
"_resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"_spec": "3.0.0",
+1
View File
@@ -24,6 +24,7 @@
"_requiredBy": [
"/bl",
"/got",
"/request",
"/tunnel-agent"
],
"_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
+3 -1
View File
@@ -22,7 +22,9 @@
"fetchSpec": "6.3.0"
},
"_requiredBy": [
"/@actions/tool-cache"
"/@actions/tool-cache",
"/istanbul-lib-instrument",
"/jest-snapshot"
],
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"_spec": "6.3.0",
+2 -1
View File
@@ -22,7 +22,8 @@
"fetchSpec": "0.6.0"
},
"_requiredBy": [
"/caw"
"/caw",
"/request"
],
"_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"_spec": "0.6.0",
+2 -1
View File
@@ -22,7 +22,8 @@
"fetchSpec": "3.3.3"
},
"_requiredBy": [
"/@actions/tool-cache"
"/@actions/tool-cache",
"/request"
],
"_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"_spec": "3.3.3",
+1
View File
@@ -22,6 +22,7 @@
"fetchSpec": "1.0.2"
},
"_requiredBy": [
"/inflight",
"/once"
],
"_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+4876 -16
View File
File diff suppressed because it is too large Load Diff
+16 -12
View File
@@ -1,13 +1,20 @@
{
"name": "goreleaser-action",
"private": true,
"description": "GitHub Action for GoReleaser, a release automation tool for Go projects",
"main": "lib/main.js",
"directories": {
"lib": "lib"
},
"scripts": {
"build": "tsc",
"test": "jest",
"format": "prettier --write **/*.ts",
"prune": "npm prune --production"
},
"repository": {
"type": "git",
"url": "git+https://github.com/crazy-max/ghaction-goreleaser.git"
"url": "git+https://github.com/goreleaser/goreleaser-action.git"
},
"keywords": [
"actions",
@@ -19,22 +26,19 @@
"dependencies": {
"@actions/core": "^1.1.1",
"@actions/exec": "^1.0.1",
"@actions/tool-cache": "^1.0.0",
"@actions/tool-cache": "^1.1.2",
"download": "^7.1.0",
"typed-rest-client": "^1.4.0"
},
"devDependencies": {
"@actions/io": "^1.0.0",
"@types/node": "^12.0.4",
"@types/download": "^6.2.4",
"cross-env": "^5.2.1",
"@types/jest": "^24.0.13",
"@types/node": "^12.7.8",
"jest": "^24.8.0",
"jest-circus": "^24.7.1",
"prettier": "^1.17.1",
"typescript": "^3.5.1"
},
"scripts": {
"build": "tsc",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"prune": "npm prune --production"
"ts-jest": "^24.0.2",
"typescript": "^3.5.1",
"typescript-formatter": "^7.2.2"
}
}
+5 -2
View File
@@ -35,7 +35,10 @@ export async function getGoReleaser(version: string): Promise<string> {
extPath = await tc.extractTar(`${tmpdir}/${fileName}`);
}
return path.join(extPath, 'goreleaser');
return path.join(
extPath,
osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'
);
}
function getFileName(): string {
@@ -58,7 +61,7 @@ interface GitHubRelease {
async function determineVersion(version: string): Promise<string> {
let rest: restm.RestClient = new restm.RestClient(
'ghaction-goreleaser',
'goreleaser-action',
'https://github.com',
undefined,
{
+28 -2
View File
@@ -1,15 +1,41 @@
import * as installer from './installer';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as fs from 'fs';
async function run() {
export async function run(silent?: boolean) {
try {
const version = core.getInput('version') || 'latest';
const args = core.getInput('args');
const key = core.getInput('key');
const goreleaser = await installer.getGoReleaser(version);
let snapshot = '';
if (
!process.env.GITHUB_REF ||
!process.env.GITHUB_REF.startsWith('refs/tags/')
) {
console.log(`⚠️ No tag found. Snapshot forced`);
if (!args.includes('--snapshot')) {
snapshot = ' --snapshot';
}
} else {
console.log(`${process.env.GITHUB_REF!.split('/')[2]} tag found`);
}
if (key) {
console.log('🔑 Importing signing key...');
let path = `${process.env.HOME}/key.asc`;
fs.writeFileSync(path, key, {mode: 0o600});
await exec.exec('gpg', ['--import', path], {
silent: silent
});
}
console.log('🏃 Running GoReleaser...');
await exec.exec(`${goreleaser} ${args}`);
await exec.exec(`${goreleaser} ${args}${snapshot}`, undefined, {
silent: silent
});
} catch (error) {
core.setFailed(error.message);
}
+2 -1
View File
@@ -9,7 +9,8 @@
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true
},
"exclude": ["node_modules"]
"exclude": ["node_modules", "**/*.test.ts"]
}