Compare commits

...
2 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
17 changed files with 91 additions and 79 deletions
+30 -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,17 +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
@@ -51,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.
+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'
+1 -1
View File
@@ -1,3 +1,3 @@
module github.com/crazy-max/ghaction-goreleaser
module github.com/goreleaser/goreleaser-action
go 1.12
+1 -1
View File
@@ -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'
}
+10
View File
@@ -19,11 +19,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
const installer = __importStar(require("./installer"));
const core = __importStar(require("@actions/core"));
const exec = __importStar(require("@actions/exec"));
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 ||
@@ -36,6 +38,14 @@ function run(silent) {
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}${snapshot}`, undefined, {
silent: silent
-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.
+9 -9
View File
@@ -19,9 +19,9 @@
"integrity": "sha512-rhq+tfZukbtaus7xyUtwKfuiCRXd1hWSfmJNEpFgBQJ4woqPEpsBw04awicjwz9tyG2/MVhAEMfVn664Cri5zA=="
},
"@actions/tool-cache": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.1.tgz",
"integrity": "sha512-AILekrrj/L4N/5z5TGtUKVie4nKjxDioCgOEymyYxzPhGfjIxfE71tN2VTTpiICEWJ883rPRj2+WinTr1b6yVA==",
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.2.tgz",
"integrity": "sha512-IJczPaZr02ECa3Lgws/TJEVco9tjOujiQSZbO3dHuXXjhd5vrUtfOgGwhmz3/f97L910OraPZ8SknofUk6RvOQ==",
"requires": {
"@actions/core": "^1.1.0",
"@actions/exec": "^1.0.1",
@@ -534,9 +534,9 @@
"dev": true
},
"@types/node": {
"version": "12.7.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz",
"integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==",
"version": "12.7.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.8.tgz",
"integrity": "sha512-FMdVn84tJJdV+xe+53sYiZS4R5yn1mAIxfj+DVoNiQjTYz1+OYmjwEZr1ev9nU0axXwda0QDbYl06QHanRVH3A==",
"dev": true
},
"@types/stack-utils": {
@@ -2668,9 +2668,9 @@
"dev": true
},
"handlebars": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.2.1.tgz",
"integrity": "sha512-bqPIlDk06UWbVEIFoYj+LVo42WhK96J+b25l7hbFDpxrOXMphFM3fNIm+cluwg4Pk2jiLjWU5nHQY7igGE75NQ==",
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.4.tgz",
"integrity": "sha512-vvpo6mpK4ScNC1DbGRZ2d5BznS6ht0r1hi20RivsibMc6jNvFAeZQ6qk5VNspo6SOwVOJQbjHyBCpuS7BzA1pw==",
"dev": true,
"requires": {
"neo-async": "^2.6.0",
+5 -4
View File
@@ -1,5 +1,6 @@
{
"name": "goreleaser-action",
"private": true,
"description": "GitHub Action for GoReleaser, a release automation tool for Go projects",
"main": "lib/main.js",
"directories": {
@@ -13,7 +14,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/crazy-max/ghaction-goreleaser.git"
"url": "git+https://github.com/goreleaser/goreleaser-action.git"
},
"keywords": [
"actions",
@@ -25,14 +26,14 @@
"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": {
"@types/jest": "^24.0.13",
"@types/node": "^12.0.4",
"@types/download": "^6.2.4",
"@types/jest": "^24.0.13",
"@types/node": "^12.7.8",
"jest": "^24.8.0",
"jest-circus": "^24.7.1",
"prettier": "^1.17.1",
+1 -1
View File
@@ -61,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,
{
+11
View File
@@ -1,11 +1,13 @@
import * as installer from './installer';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as fs from 'fs';
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 = '';
@@ -21,6 +23,15 @@ export async function run(silent?: boolean) {
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}${snapshot}`, undefined, {
silent: silent