mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-30 07:58:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
499c61b7c5 | ||
|
|
ddc7bc8b43 | ||
|
|
9c48726d5e | ||
|
|
d0f90f55ae | ||
|
|
f2a4c95ec7 | ||
|
|
3d57a20621 | ||
|
|
3f5ecc4e17 | ||
|
|
70364181ef | ||
|
|
7007251a74 | ||
|
|
c5a3850c06 | ||
|
|
4441f834e5 | ||
|
|
e8c391b2a4 | ||
|
|
608bdefa0e | ||
|
|
6389ff5bd2 | ||
|
|
9593cd0a20 | ||
|
|
d93a2cdf8c | ||
|
|
3c2d9ae011 | ||
|
|
2fc4e3ac51 | ||
|
|
097bb3c0c5 | ||
|
|
d72a78ab06 | ||
|
|
90d3577f6e | ||
|
|
309312125e | ||
|
|
46aa4473cd | ||
|
|
5c7fddc6a0 | ||
|
|
d223864797 | ||
|
|
8be826a5af | ||
|
|
3a20bfb75b | ||
|
|
bc5f714900 | ||
|
|
28f040b0c9 | ||
|
|
3784b5a5df | ||
|
|
8708f57399 | ||
|
|
044b9d4d64 | ||
|
|
0d32e80d56 | ||
|
|
eed3dc901e |
@@ -49,8 +49,39 @@ jobs:
|
|||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
args: release --skip-publish --rm-dist
|
args: release --skip-publish --rm-dist
|
||||||
|
|
||||||
|
install-only:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
version:
|
||||||
|
- latest
|
||||||
|
- v0.117.0
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.14
|
||||||
|
-
|
||||||
|
name: GoReleaser
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
install-only: true
|
||||||
|
-
|
||||||
|
name: Check
|
||||||
|
run: |
|
||||||
|
goreleaser check --debug
|
||||||
|
|
||||||
signing:
|
signing:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -72,10 +103,10 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Import GPG key
|
name: Import GPG key
|
||||||
id: import_gpg
|
id: import_gpg
|
||||||
uses: crazy-max/ghaction-import-gpg@v2
|
uses: crazy-max/ghaction-import-gpg@v3
|
||||||
env:
|
with:
|
||||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY_TEST }}
|
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY_TEST }}
|
||||||
PASSPHRASE: ${{ secrets.PASSPHRASE_TEST }}
|
passphrase: ${{ secrets.PASSPHRASE_TEST }}
|
||||||
-
|
-
|
||||||
name: Check
|
name: Check
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
run: yarn run test
|
run: yarn run test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1.0.7
|
uses: codecov/codecov-action@v1
|
||||||
if: success()
|
if: success()
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.3.0 (2020/11/06)
|
||||||
|
|
||||||
|
* Add install-only option for using goreleaser in user scripts (#252)
|
||||||
|
* Update deps
|
||||||
|
|
||||||
|
## 2.2.1 (2020/10/01)
|
||||||
|
|
||||||
|
* Fix CVE-2020-15228
|
||||||
|
|
||||||
|
## 2.2.0 (2020/08/27)
|
||||||
|
|
||||||
|
* Use GITHUB_REF to retrieve tag before checking the most recent tag (#238)
|
||||||
|
* Update deps
|
||||||
|
|
||||||
|
## 2.1.1 (2020/06/24)
|
||||||
|
|
||||||
|
* Fix workdir (#224)
|
||||||
|
|
||||||
## 2.1.0 (2020/06/15)
|
## 2.1.0 (2020/06/15)
|
||||||
|
|
||||||
* Implement (optional) semver parsing of version (#213)
|
* Implement (optional) semver parsing of version (#213)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ ___
|
|||||||
* [Workflow](#workflow)
|
* [Workflow](#workflow)
|
||||||
* [Run on new tag](#run-on-new-tag)
|
* [Run on new tag](#run-on-new-tag)
|
||||||
* [Signing](#signing)
|
* [Signing](#signing)
|
||||||
|
* [Install Only](#install-only)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [environment variables](#environment-variables)
|
* [environment variables](#environment-variables)
|
||||||
@@ -97,10 +98,10 @@ If [signing is enabled](https://goreleaser.com/customization/#Signing) in your G
|
|||||||
-
|
-
|
||||||
name: Import GPG key
|
name: Import GPG key
|
||||||
id: import_gpg
|
id: import_gpg
|
||||||
uses: crazy-max/ghaction-import-gpg@v2
|
uses: crazy-max/ghaction-import-gpg@v3
|
||||||
env:
|
with:
|
||||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
PASSPHRASE: ${{ secrets.PASSPHRASE }}
|
passphrase: ${{ secrets.PASSPHRASE }}
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v2
|
uses: goreleaser/goreleaser-action@v2
|
||||||
@@ -120,6 +121,20 @@ signs:
|
|||||||
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]
|
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Install Only
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Install GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v2
|
||||||
|
with:
|
||||||
|
install-only: true
|
||||||
|
-
|
||||||
|
name: Show GoReleaser version
|
||||||
|
run: goreleaser -v
|
||||||
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
### inputs
|
### inputs
|
||||||
@@ -131,6 +146,7 @@ Following inputs can be used as `step.with` keys
|
|||||||
| `version`**¹** | String | `latest` | GoReleaser version |
|
| `version`**¹** | String | `latest` | GoReleaser version |
|
||||||
| `args` | String | | Arguments to pass to GoReleaser |
|
| `args` | String | | Arguments to pass to GoReleaser |
|
||||||
| `workdir` | String | `.` | Working directory (below repository root) |
|
| `workdir` | String | `.` | Working directory (below repository root) |
|
||||||
|
| `install-only` | Bool | `false` | Just install GoReleaser |
|
||||||
|
|
||||||
> **¹** Can be a fixed version like `v0.117.0` or a max satisfying semver one like `~> 0.132`. In this case this will return `v0.132.1`.
|
> **¹** Can be a fixed version like `v0.117.0` or a max satisfying semver one like `~> 0.132`. In this case this will return `v0.132.1`.
|
||||||
|
|
||||||
|
|||||||
+16
-1
@@ -1,15 +1,30 @@
|
|||||||
import * as git from '../src/git';
|
import * as git from '../src/git';
|
||||||
|
|
||||||
describe('git', () => {
|
describe('git', () => {
|
||||||
it('returns git tag', async () => {
|
it('returns git tag through describe', async () => {
|
||||||
|
process.env.GITHUB_SHA = '309312125ed7a32fcd48f3a1e24dcafe669c186a';
|
||||||
const tag: string = await git.getTag();
|
const tag: string = await git.getTag();
|
||||||
|
console.log(`tag: ${tag}`);
|
||||||
expect(tag).not.toEqual('');
|
expect(tag).not.toEqual('');
|
||||||
});
|
});
|
||||||
|
it('returns git tag through GITHUB_SHA', async () => {
|
||||||
|
process.env.GITHUB_SHA = '6e37040623d14330555c7be1603a9182cf92d32a';
|
||||||
|
const tag: string = await git.getTag();
|
||||||
|
console.log(`tag: ${tag}`);
|
||||||
|
expect(tag).toEqual('v1');
|
||||||
|
});
|
||||||
|
it('returns git tag through GITHUB_REF', async () => {
|
||||||
|
process.env.GITHUB_REF = 'refs/tags/v2.2.1';
|
||||||
|
const tag: string = await git.getTag();
|
||||||
|
console.log(`tag: ${tag}`);
|
||||||
|
expect(tag).toEqual('v2.2.1');
|
||||||
|
});
|
||||||
it('checks if tag is dirty', async () => {
|
it('checks if tag is dirty', async () => {
|
||||||
expect(await git.isTagDirty('v1.3.1')).toBe(true);
|
expect(await git.isTagDirty('v1.3.1')).toBe(true);
|
||||||
});
|
});
|
||||||
it('returns short commit', async () => {
|
it('returns short commit', async () => {
|
||||||
const commit: string = await git.getShortCommit();
|
const commit: string = await git.getShortCommit();
|
||||||
|
console.log(`commit: ${commit}`);
|
||||||
expect(commit).not.toEqual('');
|
expect(commit).not.toEqual('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ describe('github', () => {
|
|||||||
const release = await github.getRelease('latest');
|
const release = await github.getRelease('latest');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
expect(release?.tag_name).not.toEqual('');
|
expect(release?.tag_name).not.toEqual('');
|
||||||
|
console.log(`tag_name: ${release?.tag_name}`);
|
||||||
});
|
});
|
||||||
it('returns v0.117.0 GoReleaser GitHub release', async () => {
|
it('returns v0.117.0 GoReleaser GitHub release', async () => {
|
||||||
const release = await github.getRelease('v0.117.0');
|
const release = await github.getRelease('v0.117.0');
|
||||||
|
|||||||
+5
-1
@@ -13,11 +13,15 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
args:
|
args:
|
||||||
description: 'Arguments to pass to GoReleaser'
|
description: 'Arguments to pass to GoReleaser'
|
||||||
required: true
|
required: false
|
||||||
workdir:
|
workdir:
|
||||||
description: 'Working directory (below repository root)'
|
description: 'Working directory (below repository root)'
|
||||||
default: '.'
|
default: '.'
|
||||||
required: false
|
required: false
|
||||||
|
install-only:
|
||||||
|
description: 'Just install GoReleaser'
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
|
|||||||
+3921
-3793
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -21,23 +21,23 @@
|
|||||||
"author": "CrazyMax",
|
"author": "CrazyMax",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.4",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/http-client": "^1.0.8",
|
"@actions/http-client": "^1.0.9",
|
||||||
"@actions/tool-cache": "^1.5.5"
|
"@actions/tool-cache": "^1.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.0",
|
"@types/jest": "^26.0.14",
|
||||||
"@types/node": "^14.0.13",
|
"@types/node": "^14.11.2",
|
||||||
"@zeit/ncc": "^0.22.3",
|
"@vercel/ncc": "^0.24.1",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"jest": "^26.0.1",
|
"jest": "^26.4.2",
|
||||||
"jest-circus": "^26.0.1",
|
"jest-circus": "^26.4.2",
|
||||||
"jest-runtime": "^26.0.1",
|
"jest-runtime": "^26.4.2",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.1.2",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"ts-jest": "^26.1.0",
|
"ts-jest": "^26.4.1",
|
||||||
"typescript": "^3.9.5",
|
"typescript": "^4.0.3",
|
||||||
"typescript-formatter": "^7.2.2"
|
"typescript-formatter": "^7.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-1
@@ -11,7 +11,20 @@ const git = async (args: string[] = []): Promise<string> => {
|
|||||||
|
|
||||||
export async function getTag(): Promise<string> {
|
export async function getTag(): Promise<string> {
|
||||||
try {
|
try {
|
||||||
return await git(['describe', '--tags', '--abbrev=0']);
|
if ((process.env.GITHUB_REF || '').startsWith('refs/tags')) {
|
||||||
|
const tag = (process.env.GITHUB_REF || '').split('/').pop();
|
||||||
|
if (tag !== '' && tag !== undefined) {
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return await git(['tag', '--points-at', `${process.env.GITHUB_SHA}`, '--sort', '-version:creatordate']).then(
|
||||||
|
tags => {
|
||||||
|
if (tags.length == 0) {
|
||||||
|
return git(['describe', '--tags', '--abbrev=0']);
|
||||||
|
}
|
||||||
|
return tags.split('\n')[0];
|
||||||
|
}
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-4
@@ -2,23 +2,35 @@ import * as git from './git';
|
|||||||
import * as installer from './installer';
|
import * as installer from './installer';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
import {dirname} from 'path';
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const version = core.getInput('version') || 'latest';
|
const version = core.getInput('version') || 'latest';
|
||||||
const args = core.getInput('args', {required: true});
|
const args = core.getInput('args');
|
||||||
const workdir = core.getInput('workdir') || '.';
|
const workdir = core.getInput('workdir') || '.';
|
||||||
|
const isInstallOnly = /^true$/i.test(core.getInput('install-only'));
|
||||||
const goreleaser = await installer.getGoReleaser(version);
|
const goreleaser = await installer.getGoReleaser(version);
|
||||||
|
core.info(`✅ GoReleaser installed successfully`);
|
||||||
|
|
||||||
const commit = await git.getShortCommit();
|
if (isInstallOnly) {
|
||||||
const tag = await git.getTag();
|
const goreleaserDir = dirname(goreleaser);
|
||||||
const isTagDirty = await git.isTagDirty(tag);
|
core.addPath(goreleaserDir);
|
||||||
|
core.debug(`Added ${goreleaserDir} to PATH`);
|
||||||
|
return;
|
||||||
|
} else if (!args) {
|
||||||
|
throw new Error('args input required');
|
||||||
|
}
|
||||||
|
|
||||||
if (workdir && workdir !== '.') {
|
if (workdir && workdir !== '.') {
|
||||||
core.info(`📂 Using ${workdir} as working directory...`);
|
core.info(`📂 Using ${workdir} as working directory...`);
|
||||||
process.chdir(workdir);
|
process.chdir(workdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const commit = await git.getShortCommit();
|
||||||
|
const tag = await git.getTag();
|
||||||
|
const isTagDirty = await git.isTagDirty(tag);
|
||||||
|
|
||||||
let snapshot = '';
|
let snapshot = '';
|
||||||
if (args.split(' ').indexOf('release') > -1) {
|
if (args.split(' ').indexOf('release') > -1) {
|
||||||
if (isTagDirty) {
|
if (isTagDirty) {
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,8 @@
|
|||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"lib": [
|
"lib": [
|
||||||
"es6"
|
"es6",
|
||||||
|
"dom"
|
||||||
],
|
],
|
||||||
"newLine": "lf",
|
"newLine": "lf",
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
|
|||||||
Reference in New Issue
Block a user