mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-29 07:18:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5742e2a039 | ||
|
|
70ccc5d2da | ||
|
|
d55bec790d | ||
|
|
f1dbd532c3 |
@@ -67,7 +67,7 @@ jobs:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
# 'latest', 'nightly', or a semver
|
||||
version: latest
|
||||
version: '~> v1'
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -96,7 +96,7 @@ Or with a condition on GoReleaser step:
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
version: latest
|
||||
version: '~> v1'
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -121,7 +121,7 @@ the [Import GPG](https://github.com/crazy-max/ghaction-import-gpg) GitHub Action
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
version: latest
|
||||
version: '~> v1'
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -146,7 +146,7 @@ purpose. You can do that with the [actions/upload-artifact](https://github.com/a
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
version: latest
|
||||
version: '~> v1'
|
||||
args: release --clean
|
||||
workdir: myfolder
|
||||
env:
|
||||
@@ -182,7 +182,7 @@ Following inputs can be used as `step.with` keys
|
||||
| Name | Type | Default | Description |
|
||||
|------------------|---------|--------------|------------------------------------------------------------------|
|
||||
| `distribution` | String | `goreleaser` | GoReleaser distribution, either `goreleaser` or `goreleaser-pro` |
|
||||
| `version`**¹** | String | `latest` | GoReleaser version |
|
||||
| `version`**¹** | String | `~> v1` | GoReleaser version |
|
||||
| `args` | String | | Arguments to pass to GoReleaser |
|
||||
| `workdir` | String | `.` | Working directory (below repository root) |
|
||||
| `install-only` | Bool | `false` | Just install GoReleaser |
|
||||
@@ -221,7 +221,7 @@ secret named `GH_PAT`, the step will look like this:
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
version: latest
|
||||
version: '~> v1'
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||
|
||||
@@ -32,6 +32,18 @@ describe('getRelease', () => {
|
||||
expect(release?.tag_name).not.toEqual('');
|
||||
});
|
||||
|
||||
it('returns latest v1 GoReleaser Pro GitHub release', async () => {
|
||||
const release = await github.getRelease('goreleaser-pro', '~> v1');
|
||||
expect(release).not.toBeNull();
|
||||
expect(release?.tag_name).not.toEqual('');
|
||||
});
|
||||
|
||||
it('returns latest v1 GoReleaser GitHub release', async () => {
|
||||
const release = await github.getRelease('goreleaser', '~> v1');
|
||||
expect(release).not.toBeNull();
|
||||
expect(release?.tag_name).not.toEqual('');
|
||||
});
|
||||
|
||||
it('returns nightly GoReleaser GitHub release', async () => {
|
||||
const release = await github.getRelease('goreleaser', 'nightly');
|
||||
expect(release).not.toBeNull();
|
||||
|
||||
@@ -18,6 +18,16 @@ describe('install', () => {
|
||||
expect(fs.existsSync(bin)).toBe(true);
|
||||
}, 100000);
|
||||
|
||||
it('acquires latest v1 version of GoReleaser', async () => {
|
||||
const bin = await goreleaser.install('goreleaser', '~> v1');
|
||||
expect(fs.existsSync(bin)).toBe(true);
|
||||
}, 100000);
|
||||
|
||||
it('acquires latest v1 version of GoReleaser Pro', async () => {
|
||||
const bin = await goreleaser.install('goreleaser-pro', '~> v1');
|
||||
expect(fs.existsSync(bin)).toBe(true);
|
||||
}, 100000);
|
||||
|
||||
it('acquires latest version of GoReleaser Pro', async () => {
|
||||
const bin = await goreleaser.install('goreleaser-pro', 'latest');
|
||||
expect(fs.existsSync(bin)).toBe(true);
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ inputs:
|
||||
required: false
|
||||
version:
|
||||
description: 'GoReleaser version'
|
||||
default: 'latest'
|
||||
default: '~> v1'
|
||||
required: false
|
||||
args:
|
||||
description: 'Arguments to pass to GoReleaser'
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
-38
@@ -258,25 +258,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
lru-cache
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
require-directory
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
@@ -441,25 +422,6 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
|
||||
|
||||
yallist
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
yargs
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
"@actions/http-client": "^2.2.1",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"semver": "^7.6.0",
|
||||
"semver": "^7.6.2",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ export interface Inputs {
|
||||
export async function getInputs(): Promise<Inputs> {
|
||||
return {
|
||||
distribution: core.getInput('distribution') || 'goreleaser',
|
||||
version: core.getInput('version') || 'latest',
|
||||
version: core.getInput('version') || '~> v1',
|
||||
args: core.getInput('args'),
|
||||
workdir: core.getInput('workdir') || '.',
|
||||
installOnly: core.getBooleanInput('install-only')
|
||||
|
||||
+3
-14
@@ -8,8 +8,10 @@ export interface GitHubRelease {
|
||||
}
|
||||
|
||||
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
|
||||
// TODO: change this to ~> v2 on a future major, once goreleaser v2 is out
|
||||
if (version === 'latest') {
|
||||
return getLatestRelease(distribution);
|
||||
core.warning("You are using 'latest' as default version. Will lock to '~> v1'.");
|
||||
return getReleaseTag(distribution, '~> v1');
|
||||
}
|
||||
return getReleaseTag(distribution, version);
|
||||
};
|
||||
@@ -38,19 +40,6 @@ export const getReleaseTag = async (distribution: string, version: string): Prom
|
||||
throw new Error(`Cannot find GoReleaser release ${version}${suffix} in ${url}`);
|
||||
};
|
||||
|
||||
export const getLatestRelease = async (distribution: string): Promise<GitHubRelease> => {
|
||||
const suffix: string = goreleaser.distribSuffix(distribution);
|
||||
const url = `https://goreleaser.com/static/latest${suffix}`;
|
||||
const http: httpm.HttpClient = new httpm.HttpClient('goreleaser-action');
|
||||
const resp: httpm.HttpClientResponse = await http.get(url);
|
||||
const body = await resp.readBody();
|
||||
const statusCode = resp.message.statusCode || 500;
|
||||
if (statusCode >= 400) {
|
||||
throw new Error(`Failed to get GoReleaser release latest from ${url} with status code ${statusCode}: ${body}`);
|
||||
}
|
||||
return {tag_name: body};
|
||||
};
|
||||
|
||||
const resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
||||
const allTags: Array<string> | null = await getAllTags(distribution);
|
||||
if (!allTags) {
|
||||
|
||||
@@ -3105,7 +3105,7 @@ __metadata:
|
||||
jest: ^29.6.4
|
||||
js-yaml: ^4.1.0
|
||||
prettier: ^3.0.3
|
||||
semver: ^7.6.0
|
||||
semver: ^7.6.2
|
||||
tmp: ^0.2.1
|
||||
ts-jest: ^29.1.1
|
||||
ts-node: ^10.9.1
|
||||
@@ -4895,14 +4895,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"semver@npm:^7.6.0":
|
||||
version: 7.6.0
|
||||
resolution: "semver@npm:7.6.0"
|
||||
dependencies:
|
||||
lru-cache: ^6.0.0
|
||||
"semver@npm:^7.6.2":
|
||||
version: 7.6.2
|
||||
resolution: "semver@npm:7.6.2"
|
||||
bin:
|
||||
semver: bin/semver.js
|
||||
checksum: 7427f05b70786c696640edc29fdd4bc33b2acf3bbe1740b955029044f80575fc664e1a512e4113c3af21e767154a94b4aa214bf6cd6e42a1f6dba5914e0b208c
|
||||
checksum: 40f6a95101e8d854357a644da1b8dd9d93ce786d5c6a77227bc69dbb17bea83d0d1d1d7c4cd5920a6df909f48e8bd8a5909869535007f90278289f2451d0292d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user