mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-29 10:08:28 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4b0533a52 | ||
|
|
b885aa77a9 |
@@ -67,7 +67,7 @@ jobs:
|
|||||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
# 'latest', 'nightly', or a semver
|
# 'latest', 'nightly', or a semver
|
||||||
version: '~> v1'
|
version: latest
|
||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -96,7 +96,7 @@ Or with a condition on GoReleaser step:
|
|||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
version: '~> v1'
|
version: latest
|
||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
with:
|
with:
|
||||||
version: '~> v1'
|
version: latest
|
||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
with:
|
with:
|
||||||
version: '~> v1'
|
version: latest
|
||||||
args: release --clean
|
args: release --clean
|
||||||
workdir: myfolder
|
workdir: myfolder
|
||||||
env:
|
env:
|
||||||
@@ -182,7 +182,7 @@ Following inputs can be used as `step.with` keys
|
|||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|------------------|---------|--------------|------------------------------------------------------------------|
|
|------------------|---------|--------------|------------------------------------------------------------------|
|
||||||
| `distribution` | String | `goreleaser` | GoReleaser distribution, either `goreleaser` or `goreleaser-pro` |
|
| `distribution` | String | `goreleaser` | GoReleaser distribution, either `goreleaser` or `goreleaser-pro` |
|
||||||
| `version`**¹** | String | `~> v1` | 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 |
|
| `install-only` | Bool | `false` | Just install GoReleaser |
|
||||||
@@ -221,7 +221,7 @@ secret named `GH_PAT`, the step will look like this:
|
|||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
with:
|
with:
|
||||||
version: '~> v1'
|
version: latest
|
||||||
args: release --clean
|
args: release --clean
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
|
|||||||
@@ -32,18 +32,6 @@ describe('getRelease', () => {
|
|||||||
expect(release?.tag_name).not.toEqual('');
|
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 () => {
|
it('returns nightly GoReleaser GitHub release', async () => {
|
||||||
const release = await github.getRelease('goreleaser', 'nightly');
|
const release = await github.getRelease('goreleaser', 'nightly');
|
||||||
expect(release).not.toBeNull();
|
expect(release).not.toBeNull();
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
version:
|
version:
|
||||||
description: 'GoReleaser version'
|
description: 'GoReleaser version'
|
||||||
default: '~> v1'
|
default: 'latest'
|
||||||
required: false
|
required: false
|
||||||
args:
|
args:
|
||||||
description: 'Arguments to pass to GoReleaser'
|
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,6 +258,25 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||||||
THE SOFTWARE.
|
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
|
require-directory
|
||||||
MIT
|
MIT
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
@@ -422,6 +441,25 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|||||||
THIS SOFTWARE.
|
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
|
yargs
|
||||||
MIT
|
MIT
|
||||||
MIT License
|
MIT License
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
"@actions/http-client": "^2.2.1",
|
"@actions/http-client": "^2.2.1",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"semver": "^7.6.2",
|
"semver": "^7.6.0",
|
||||||
"yargs": "^17.7.2"
|
"yargs": "^17.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ export interface Inputs {
|
|||||||
export async function getInputs(): Promise<Inputs> {
|
export async function getInputs(): Promise<Inputs> {
|
||||||
return {
|
return {
|
||||||
distribution: core.getInput('distribution') || 'goreleaser',
|
distribution: core.getInput('distribution') || 'goreleaser',
|
||||||
version: core.getInput('version') || '~> v1',
|
version: core.getInput('version') || 'latest',
|
||||||
args: core.getInput('args'),
|
args: core.getInput('args'),
|
||||||
workdir: core.getInput('workdir') || '.',
|
workdir: core.getInput('workdir') || '.',
|
||||||
installOnly: core.getBooleanInput('install-only')
|
installOnly: core.getBooleanInput('install-only')
|
||||||
|
|||||||
+17
-3
@@ -8,10 +8,11 @@ export interface GitHubRelease {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const getRelease = async (distribution: string, version: string): Promise<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') {
|
if (version === 'latest') {
|
||||||
core.warning("You are using 'latest' as default version. Will lock to '~> v1'.");
|
core.warning(
|
||||||
return getReleaseTag(distribution, '~> v1');
|
"You are using 'latest' as default version. This might include breaking changes. It is recommended to use a SemVer to lock to a major version (e.g. ~> v1)."
|
||||||
|
);
|
||||||
|
return getLatestRelease(distribution);
|
||||||
}
|
}
|
||||||
return getReleaseTag(distribution, version);
|
return getReleaseTag(distribution, version);
|
||||||
};
|
};
|
||||||
@@ -40,6 +41,19 @@ export const getReleaseTag = async (distribution: string, version: string): Prom
|
|||||||
throw new Error(`Cannot find GoReleaser release ${version}${suffix} in ${url}`);
|
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 resolveVersion = async (distribution: string, version: string): Promise<string | null> => {
|
||||||
const allTags: Array<string> | null = await getAllTags(distribution);
|
const allTags: Array<string> | null = await getAllTags(distribution);
|
||||||
if (!allTags) {
|
if (!allTags) {
|
||||||
|
|||||||
@@ -3105,7 +3105,7 @@ __metadata:
|
|||||||
jest: ^29.6.4
|
jest: ^29.6.4
|
||||||
js-yaml: ^4.1.0
|
js-yaml: ^4.1.0
|
||||||
prettier: ^3.0.3
|
prettier: ^3.0.3
|
||||||
semver: ^7.6.2
|
semver: ^7.6.0
|
||||||
tmp: ^0.2.1
|
tmp: ^0.2.1
|
||||||
ts-jest: ^29.1.1
|
ts-jest: ^29.1.1
|
||||||
ts-node: ^10.9.1
|
ts-node: ^10.9.1
|
||||||
@@ -4895,12 +4895,14 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"semver@npm:^7.6.2":
|
"semver@npm:^7.6.0":
|
||||||
version: 7.6.2
|
version: 7.6.0
|
||||||
resolution: "semver@npm:7.6.2"
|
resolution: "semver@npm:7.6.0"
|
||||||
|
dependencies:
|
||||||
|
lru-cache: ^6.0.0
|
||||||
bin:
|
bin:
|
||||||
semver: bin/semver.js
|
semver: bin/semver.js
|
||||||
checksum: 40f6a95101e8d854357a644da1b8dd9d93ce786d5c6a77227bc69dbb17bea83d0d1d1d7c4cd5920a6df909f48e8bd8a5909869535007f90278289f2451d0292d
|
checksum: 7427f05b70786c696640edc29fdd4bc33b2acf3bbe1740b955029044f80575fc664e1a512e4113c3af21e767154a94b4aa214bf6cd6e42a1f6dba5914e0b208c
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user